github.com/adacta-ru/mattermost-server/v6@v6.0.0/app/app_iface.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  // Code generated by "make app-layers"
     5  // DO NOT EDIT
     6  
     7  package app
     8  
     9  import (
    10  	"bytes"
    11  	"context"
    12  	"crypto/ecdsa"
    13  	"io"
    14  	"mime/multipart"
    15  	"net/http"
    16  	"net/url"
    17  	"time"
    18  
    19  	"github.com/dyatlov/go-opengraph/opengraph"
    20  	"github.com/gorilla/websocket"
    21  	"github.com/mattermost/go-i18n/i18n"
    22  	goi18n "github.com/mattermost/go-i18n/i18n"
    23  	"github.com/adacta-ru/mattermost-server/v6/audit"
    24  	"github.com/adacta-ru/mattermost-server/v6/einterfaces"
    25  	"github.com/adacta-ru/mattermost-server/v6/mlog"
    26  	"github.com/adacta-ru/mattermost-server/v6/model"
    27  	"github.com/adacta-ru/mattermost-server/v6/plugin"
    28  	"github.com/adacta-ru/mattermost-server/v6/services/filesstore"
    29  	"github.com/adacta-ru/mattermost-server/v6/services/httpservice"
    30  	"github.com/adacta-ru/mattermost-server/v6/services/imageproxy"
    31  	"github.com/adacta-ru/mattermost-server/v6/services/searchengine"
    32  	"github.com/adacta-ru/mattermost-server/v6/services/timezones"
    33  	"github.com/adacta-ru/mattermost-server/v6/store"
    34  )
    35  
    36  // AppIface is extracted from App struct and contains all it's exported methods. It's provided to allow partial interface passing and app layers creation.
    37  type AppIface interface {
    38  	// @openTracingParams args
    39  	ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
    40  	// @openTracingParams teamId
    41  	// previous ListCommands now ListAutocompleteCommands
    42  	ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
    43  	// @openTracingParams teamId, skipSlackParsing
    44  	CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError)
    45  	// AddCursorIdsForPostList adds NextPostId and PrevPostId as cursor to the PostList.
    46  	// The conditional blocks ensure that it sets those cursor IDs immediately as afterPost, beforePost or empty,
    47  	// and only query to database whenever necessary.
    48  	AddCursorIdsForPostList(originalList *model.PostList, afterPost, beforePost string, since int64, page, perPage int)
    49  	// AddPublicKey will add plugin public key to the config. Overwrites the previous file
    50  	AddPublicKey(name string, key io.Reader) *model.AppError
    51  	// Caller must close the first return value
    52  	FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError)
    53  	// ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given
    54  	// groups.
    55  	//
    56  	// The result can be used, for example, to determine the set of users who would be removed from a channel if the
    57  	// channel were group-constrained with the given groups.
    58  	ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
    59  	// ClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
    60  	ClientConfigWithComputed() map[string]string
    61  	// ConvertBotToUser converts a bot to user.
    62  	ConvertBotToUser(bot *model.Bot, userPatch *model.UserPatch, sysadmin bool) (*model.User, *model.AppError)
    63  	// ConvertUserToBot converts a user to bot.
    64  	ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)
    65  	// CreateBot creates the given bot and corresponding user.
    66  	CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
    67  	// CreateChannelScheme creates a new Scheme of scope channel and assigns it to the channel.
    68  	CreateChannelScheme(channel *model.Channel) (*model.Scheme, *model.AppError)
    69  	// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
    70  	//
    71  	CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)
    72  	// CreateDefaultMemberships adds users to teams and channels based on their group memberships and how those groups
    73  	// are configured to sync with teams and channels for group members on or after the given timestamp.
    74  	CreateDefaultMemberships(since int64) error
    75  	// CreateGuest creates a guest and sets several fields of the returned User struct to
    76  	// their zero values.
    77  	CreateGuest(user *model.User) (*model.User, *model.AppError)
    78  	// CreateUser creates a user and sets several fields of the returned User struct to
    79  	// their zero values.
    80  	CreateUser(user *model.User) (*model.User, *model.AppError)
    81  	// Creates and stores FileInfos for a post created before the FileInfos table existed.
    82  	MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo
    83  	// DefaultChannelNames returns the list of system-wide default channel names.
    84  	//
    85  	// By default the list will be (not necessarily in this order):
    86  	//	['town-square', 'off-topic']
    87  	// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
    88  	// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
    89  	//	['town-square', 'game-of-thrones', 'wow']
    90  	//
    91  	DefaultChannelNames() []string
    92  	// DeleteBotIconImage deletes LHS icon for a bot.
    93  	DeleteBotIconImage(botUserId string) *model.AppError
    94  	// DeleteChannelScheme deletes a channels scheme and sets its SchemeId to nil.
    95  	DeleteChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
    96  	// DeleteGroupConstrainedMemberships deletes team and channel memberships of users who aren't members of the allowed
    97  	// groups of all group-constrained teams and channels.
    98  	DeleteGroupConstrainedMemberships() error
    99  	// DeletePublicKey will delete plugin public key from the config.
   100  	DeletePublicKey(name string) *model.AppError
   101  	// DemoteUserToGuest Convert user's roles and all his mermbership's roles from
   102  	// regular user roles to guest roles.
   103  	DemoteUserToGuest(user *model.User) *model.AppError
   104  	// DisablePlugin will set the config for an installed plugin to disabled, triggering deactivation if active.
   105  	// Notifies cluster peers through config change.
   106  	DisablePlugin(id string) *model.AppError
   107  	// DoPermissionsMigrations execute all the permissions migrations need by the current version.
   108  	DoPermissionsMigrations() error
   109  	// EnablePlugin will set the config for an installed plugin to enabled, triggering asynchronous
   110  	// activation if inactive anywhere in the cluster.
   111  	// Notifies cluster peers through config change.
   112  	EnablePlugin(id string) *model.AppError
   113  	// Expand announcements in incoming webhooks from Slack. Those announcements
   114  	// can be found in the text attribute, or in the pretext, text, title and value
   115  	// attributes of the attachment structure. The Slack attachment structure is
   116  	// documented here: https://api.slack.com/docs/attachments
   117  	ProcessSlackAttachments(attachments []*model.SlackAttachment) []*model.SlackAttachment
   118  	// ExtendSessionExpiryIfNeeded extends Session.ExpiresAt based on session lengths in config.
   119  	// A new ExpiresAt is only written if enough time has elapsed since last update.
   120  	// Returns true only if the session was extended.
   121  	ExtendSessionExpiryIfNeeded(session *model.Session) bool
   122  	// FillInPostProps should be invoked before saving posts to fill in properties such as
   123  	// channel_mentions.
   124  	//
   125  	// If channel is nil, FillInPostProps will look up the channel corresponding to the post.
   126  	FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError
   127  	// FilterNonGroupChannelMembers returns the subset of the given user IDs of the users who are not members of groups
   128  	// associated to the channel excluding bots
   129  	FilterNonGroupChannelMembers(userIds []string, channel *model.Channel) ([]string, error)
   130  	// FilterNonGroupTeamMembers returns the subset of the given user IDs of the users who are not members of groups
   131  	// associated to the team excluding bots.
   132  	FilterNonGroupTeamMembers(userIds []string, team *model.Team) ([]string, error)
   133  	// GetAllLdapGroupsPage retrieves all LDAP groups under the configured base DN using the default or configured group
   134  	// filter.
   135  	GetAllLdapGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
   136  	// GetBot returns the given bot.
   137  	GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
   138  	// GetBotIconImage retrieves LHS icon for a bot.
   139  	GetBotIconImage(botUserId string) ([]byte, *model.AppError)
   140  	// GetBots returns the requested page of bots.
   141  	GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
   142  	// GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.
   143  	GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)
   144  	// GetChannelModerationsForChannel Gets a channels ChannelModerations from either the higherScoped roles or from the channel scheme roles.
   145  	GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)
   146  	// GetClusterPluginStatuses returns the status for plugins installed anywhere in the cluster.
   147  	GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)
   148  	// GetConfigFile proxies access to the given configuration file to the underlying config store.
   149  	GetConfigFile(name string) ([]byte, error)
   150  	// GetEmojiStaticUrl returns a relative static URL for system default emojis,
   151  	// and the API route for custom ones. Errors if not found or if custom and deleted.
   152  	GetEmojiStaticUrl(emojiName string) (string, *model.AppError)
   153  	// GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable.
   154  	GetEnvironmentConfig() map[string]interface{}
   155  	// GetFilteredUsersStats is used to get a count of users based on the set of filters supported by UserCountOptions.
   156  	GetFilteredUsersStats(options *model.UserCountOptions) (*model.UsersStats, *model.AppError)
   157  	// GetGroupsByTeam returns the paged list and the total count of group associated to the given team.
   158  	GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)
   159  	// GetKnownUsers returns the list of user ids of users with any direct
   160  	// relationship with a user. That means any user sharing any channel, including
   161  	// direct and group channels.
   162  	GetKnownUsers(userID string) ([]string, *model.AppError)
   163  	// GetLdapGroup retrieves a single LDAP group by the given LDAP group id.
   164  	GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError)
   165  	// GetMarketplacePlugins returns a list of plugins from the marketplace-server,
   166  	// and plugins that are installed locally.
   167  	GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*model.MarketplacePlugin, *model.AppError)
   168  	// GetPluginPublicKeyFiles returns all public keys listed in the config.
   169  	GetPluginPublicKeyFiles() ([]string, *model.AppError)
   170  	// GetPluginStatus returns the status for a plugin installed on this server.
   171  	GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
   172  	// GetPluginStatuses returns the status for plugins installed on this server.
   173  	GetPluginStatuses() (model.PluginStatuses, *model.AppError)
   174  	// GetPluginsEnvironment returns the plugin environment for use if plugins are enabled and
   175  	// initialized.
   176  	//
   177  	// To get the plugins environment when the plugins are disabled, manually acquire the plugins
   178  	// lock instead.
   179  	GetPluginsEnvironment() *plugin.Environment
   180  	// GetProductNotices is called from the frontend to fetch the product notices that are relevant to the caller
   181  	GetProductNotices(userId, teamId string, client model.NoticeClientType, clientVersion string, locale string) (model.NoticeMessages, *model.AppError)
   182  	// GetPublicKey will return the actual public key saved in the `name` file.
   183  	GetPublicKey(name string) ([]byte, *model.AppError)
   184  	// GetSanitizedConfig gets the configuration for a system admin without any secrets.
   185  	GetSanitizedConfig() *model.Config
   186  	// GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles.
   187  	GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
   188  	// GetSessionLengthInMillis returns the session length, in milliseconds,
   189  	// based on the type of session (Mobile, SSO, Web/LDAP).
   190  	GetSessionLengthInMillis(session *model.Session) int64
   191  	// GetSuggestions returns suggestions for user input.
   192  	GetSuggestions(commandArgs *model.CommandArgs, commands []*model.Command, roleID string) []model.AutocompleteSuggestion
   193  	// GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.
   194  	GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)
   195  	// GetTeamSchemeChannelRoles Checks if a team has an override scheme and returns the scheme channel role names or default channel role names.
   196  	GetTeamSchemeChannelRoles(teamId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
   197  	// GetTotalUsersStats is used for the DM list total
   198  	GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)
   199  	// HubRegister registers a connection to a hub.
   200  	HubRegister(webConn *WebConn)
   201  	// HubStart starts all the hubs.
   202  	HubStart()
   203  	// HubUnregister unregisters a connection from a hub.
   204  	HubUnregister(webConn *WebConn)
   205  	// InstallMarketplacePlugin installs a plugin listed in the marketplace server. It will get the plugin bundle
   206  	// from the prepackaged folder, if available, or remotely if EnableRemoteMarketplace is true.
   207  	InstallMarketplacePlugin(request *model.InstallMarketplacePluginRequest) (*model.Manifest, *model.AppError)
   208  	// InstallPlugin unpacks and installs a plugin but does not enable or activate it.
   209  	InstallPlugin(pluginFile io.ReadSeeker, replace bool) (*model.Manifest, *model.AppError)
   210  	// InstallPluginWithSignature verifies and installs plugin.
   211  	InstallPluginWithSignature(pluginFile, signature io.ReadSeeker) (*model.Manifest, *model.AppError)
   212  	// IsUsernameTaken checks if the username is already used by another user. Return false if the username is invalid.
   213  	IsUsernameTaken(name string) bool
   214  	// LimitedClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
   215  	LimitedClientConfigWithComputed() map[string]string
   216  	// LogAuditRec logs an audit record using default LvlAuditCLI.
   217  	LogAuditRec(rec *audit.Record, err error)
   218  	// LogAuditRecWithLevel logs an audit record using specified Level.
   219  	LogAuditRecWithLevel(rec *audit.Record, level mlog.LogLevel, err error)
   220  	// MakeAuditRecord creates a audit record pre-populated with defaults.
   221  	MakeAuditRecord(event string, initialStatus string) *audit.Record
   222  	// MarkChanelAsUnreadFromPost will take a post and set the channel as unread from that one.
   223  	MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)
   224  	// MentionsToPublicChannels returns all the mentions to public channels,
   225  	// linking them to their channels
   226  	MentionsToPublicChannels(message, teamId string) model.ChannelMentionMap
   227  	// MentionsToTeamMembers returns all the @ mentions found in message that
   228  	// belong to users in the specified team, linking them to their users
   229  	MentionsToTeamMembers(message, teamId string) model.UserMentionMap
   230  	// MoveChannel method is prone to data races if someone joins to channel during the move process. However this
   231  	// function is only exposed to sysadmins and the possibility of this edge case is relatively small.
   232  	MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError
   233  	// NewWebConn returns a new WebConn instance.
   234  	NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn
   235  	// NewWebHub creates a new Hub.
   236  	NewWebHub() *Hub
   237  	// NotifySessionsExpired is called periodically from the job server to notify any mobile sessions that have expired.
   238  	NotifySessionsExpired() *model.AppError
   239  	// OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon,
   240  	// so that it points to the URL (relative) of the emoji - static if emoji is default, /api if custom.
   241  	OverrideIconURLIfEmoji(post *model.Post)
   242  	// PatchBot applies the given patch to the bot and corresponding user.
   243  	PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
   244  	// PatchChannelModerationsForChannel Updates a channels scheme roles based on a given ChannelModerationPatch, if the permissions match the higher scoped role the scheme is deleted.
   245  	PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
   246  	// Perform an HTTP POST request to an integration's action endpoint.
   247  	// Caller must consume and close returned http.Response as necessary.
   248  	// For internal requests, requests are routed directly to a plugin ServerHTTP hook
   249  	DoActionRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
   250  	// PermanentDeleteBot permanently deletes a bot and its corresponding user.
   251  	PermanentDeleteBot(botUserId string) *model.AppError
   252  	// PromoteGuestToUser Convert user's roles and all his mermbership's roles from
   253  	// guest roles to regular user roles.
   254  	PromoteGuestToUser(user *model.User, requestorId string) *model.AppError
   255  	// RenameChannel is used to rename the channel Name and the DisplayName fields
   256  	RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError)
   257  	// RenameTeam is used to rename the team Name and the DisplayName fields
   258  	RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError)
   259  	// RevokeSessionsFromAllUsers will go through all the sessions active
   260  	// in the server and revoke them
   261  	RevokeSessionsFromAllUsers() *model.AppError
   262  	// SaveConfig replaces the active configuration, optionally notifying cluster peers.
   263  	SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError
   264  	// SearchAllChannels returns a list of channels, the total count of the results of the search (if the paginate search option is true), and an error.
   265  	SearchAllChannels(term string, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, *model.AppError)
   266  	// SearchAllTeams returns a team list and the total count of the results
   267  	SearchAllTeams(searchOpts *model.TeamSearch) ([]*model.Team, int64, *model.AppError)
   268  	// SendNoCardPaymentFailedEmail
   269  	SendNoCardPaymentFailedEmail() *model.AppError
   270  	// ServePluginPublicRequest serves public plugin files
   271  	// at the URL http(s)://$SITE_URL/plugins/$PLUGIN_ID/public/{anything}
   272  	ServePluginPublicRequest(w http.ResponseWriter, r *http.Request)
   273  	// ServerBusyStateChanged is called when a CLUSTER_EVENT_BUSY_STATE_CHANGED is received.
   274  	ServerBusyStateChanged(sbs *model.ServerBusyState)
   275  	// SessionHasPermissionToManageBot returns nil if the session has access to manage the given bot.
   276  	// This function deviates from other authorization checks in returning an error instead of just
   277  	// a boolean, allowing the permission failure to be exposed with more granularity.
   278  	SessionHasPermissionToManageBot(session model.Session, botUserId string) *model.AppError
   279  	// SessionIsRegistered determines if a specific session has been registered
   280  	SessionIsRegistered(session model.Session) bool
   281  	// SetBotIconImage sets LHS icon for a bot.
   282  	SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError
   283  	// SetBotIconImageFromMultiPartFile sets LHS icon for a bot.
   284  	SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError
   285  	// SetSessionExpireInDays sets the session's expiry the specified number of days
   286  	// relative to either the session creation date or the current time, depending
   287  	// on the `ExtendSessionOnActivity` config setting.
   288  	SetSessionExpireInDays(session *model.Session, days int)
   289  	// SetStatusLastActivityAt sets the last activity at for a user on the local app server and updates
   290  	// status to away if needed. Used by the WS to set status to away if an 'online' device disconnects
   291  	// while an 'away' device is still connected
   292  	SetStatusLastActivityAt(userId string, activityAt int64)
   293  	// SyncPlugins synchronizes the plugins installed locally
   294  	// with the plugin bundles available in the file store.
   295  	SyncPlugins() *model.AppError
   296  	// SyncRolesAndMembership updates the SchemeAdmin status and membership of all of the members of the given
   297  	// syncable.
   298  	SyncRolesAndMembership(syncableID string, syncableType model.GroupSyncableType)
   299  	// SyncSyncableRoles updates the SchemeAdmin field value of the given syncable's members based on the configuration of
   300  	// the member's group memberships and the configuration of those groups to the syncable. This method should only
   301  	// be invoked on group-synced (aka group-constrained) syncables.
   302  	SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError
   303  	// TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given
   304  	// groups.
   305  	//
   306  	// The result can be used, for example, to determine the set of users who would be removed from a team if the team
   307  	// were group-constrained with the given groups.
   308  	TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
   309  	// This function migrates the default built in roles from code/config to the database.
   310  	DoAdvancedPermissionsMigration()
   311  	// This to be used for places we check the users password when they are already logged in
   312  	DoubleCheckPassword(user *model.User, password string) *model.AppError
   313  	// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
   314  	UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
   315  	// UpdateBotOwner changes a bot's owner to the given value.
   316  	UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)
   317  	// UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.
   318  	UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
   319  	// UpdateChannelScheme saves the new SchemeId of the channel passed.
   320  	UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
   321  	// UpdateProductNotices is called periodically from a scheduled worker to fetch new notices and update the cache
   322  	UpdateProductNotices() *model.AppError
   323  	// UpdateViewedProductNotices is called from the frontend to mark a set of notices as 'viewed' by user
   324  	UpdateViewedProductNotices(userId string, noticeIds []string) *model.AppError
   325  	// UpdateViewedProductNoticesForNewUser is called when new user is created to mark all current notices for this
   326  	// user as viewed in order to avoid showing them imminently on first login
   327  	UpdateViewedProductNoticesForNewUser(userId string)
   328  	// UpdateWebConnUserActivity sets the LastUserActivityAt of the hub for the given session.
   329  	UpdateWebConnUserActivity(session model.Session, activityAt int64)
   330  	// UploadFile uploads a single file in form of a completely constructed byte array for a channel.
   331  	UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
   332  	// UploadFileX uploads a single file as specified in t. It applies the upload
   333  	// constraints, executes plugins and image processing logic as needed. It
   334  	// returns a filled-out FileInfo and an optional error. A plugin may reject the
   335  	// upload, returning a rejection error. In this case FileInfo would have
   336  	// contained the last "good" FileInfo before the execution of that plugin.
   337  	UploadFileX(channelId, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError)
   338  	// Uploads some files to the given team and channel as the given user. files and filenames should have
   339  	// the same length. clientIds should either not be provided or have the same length as files and filenames.
   340  	// The provided files should be closed by the caller so that they are not leaked.
   341  	UploadFiles(teamId string, channelId string, userId string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
   342  	// UserIsInAdminRoleGroup returns true at least one of the user's groups are configured to set the members as
   343  	// admins in the given syncable.
   344  	UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError)
   345  	// VerifyPlugin checks that the given signature corresponds to the given plugin and matches a trusted certificate.
   346  	VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError
   347  	//GetUserStatusesByIds used by apiV4
   348  	GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)
   349  	AcceptLanguage() string
   350  	AccountMigration() einterfaces.AccountMigrationInterface
   351  	ActivateMfa(userId, token string) *model.AppError
   352  	AddChannelMember(userId string, channel *model.Channel, userRequestorId string, postRootId string) (*model.ChannelMember, *model.AppError)
   353  	AddConfigListener(listener func(*model.Config, *model.Config)) string
   354  	AddDirectChannels(teamId string, user *model.User) *model.AppError
   355  	AddLdapPrivateCertificate(fileData *multipart.FileHeader) *model.AppError
   356  	AddLdapPublicCertificate(fileData *multipart.FileHeader) *model.AppError
   357  	AddSamlIdpCertificate(fileData *multipart.FileHeader) *model.AppError
   358  	AddSamlPrivateCertificate(fileData *multipart.FileHeader) *model.AppError
   359  	AddSamlPublicCertificate(fileData *multipart.FileHeader) *model.AppError
   360  	AddSessionToCache(session *model.Session)
   361  	AddStatusCache(status *model.Status)
   362  	AddStatusCacheSkipClusterSend(status *model.Status)
   363  	AddTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
   364  	AddTeamMemberByInviteId(inviteId, userId string) (*model.TeamMember, *model.AppError)
   365  	AddTeamMemberByToken(userId, tokenId string) (*model.TeamMember, *model.AppError)
   366  	AddTeamMembers(teamId string, userIds []string, userRequestorId string, graceful bool) ([]*model.TeamMemberWithError, *model.AppError)
   367  	AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelMember, *model.AppError)
   368  	AddUserToTeam(teamId string, userId string, userRequestorId string) (*model.Team, *model.AppError)
   369  	AddUserToTeamByInviteId(inviteId string, userId string) (*model.Team, *model.AppError)
   370  	AddUserToTeamByTeamId(teamId string, user *model.User) *model.AppError
   371  	AddUserToTeamByToken(userId string, tokenId string) (*model.Team, *model.AppError)
   372  	AdjustImage(file io.Reader) (*bytes.Buffer, *model.AppError)
   373  	AllowOAuthAppAccessToUser(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)
   374  	AppendFile(fr io.Reader, path string) (int64, *model.AppError)
   375  	AsymmetricSigningKey() *ecdsa.PrivateKey
   376  	AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError
   377  	AttachSessionCookies(w http.ResponseWriter, r *http.Request)
   378  	AuthenticateUserForLogin(id, loginId, password, mfaToken, cwsToken string, ldapOnly bool) (user *model.User, err *model.AppError)
   379  	AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (io.ReadCloser, string, map[string]string, *model.User, *model.AppError)
   380  	AutocompleteChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
   381  	AutocompleteChannelsForSearch(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)
   382  	AutocompleteUsersInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError)
   383  	AutocompleteUsersInTeam(teamId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInTeam, *model.AppError)
   384  	BroadcastStatus(status *model.Status)
   385  	BuildPostReactions(postId string) (*[]ReactionImportData, *model.AppError)
   386  	BuildPushNotificationMessage(contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string, explicitMention bool, channelWideMention bool, replyToThreadType string) (*model.PushNotification, *model.AppError)
   387  	BuildSamlMetadataObject(idpMetadata []byte) (*model.SamlMetadataResponse, *model.AppError)
   388  	BulkExport(writer io.Writer, file string, pathToEmojiDir string, dirNameToExportEmoji string) *model.AppError
   389  	BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model.AppError, int)
   390  	BulkImportWithPath(fileReader io.Reader, dryRun bool, workers int, importPath string) (*model.AppError, int)
   391  	CancelJob(jobId string) *model.AppError
   392  	ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError)
   393  	ChannelMembersToRemove(teamID *string) ([]*model.ChannelMember, *model.AppError)
   394  	CheckAndSendUserLimitWarningEmails() *model.AppError
   395  	CheckForClientSideCert(r *http.Request) (string, string, string)
   396  	CheckMandatoryS3Fields(settings *model.FileSettings) *model.AppError
   397  	CheckPasswordAndAllCriteria(user *model.User, password string, mfaToken string) *model.AppError
   398  	CheckRolesExist(roleNames []string) *model.AppError
   399  	CheckUserAllAuthenticationCriteria(user *model.User, mfaToken string) *model.AppError
   400  	CheckUserMfa(user *model.User, token string) *model.AppError
   401  	CheckUserPostflightAuthenticationCriteria(user *model.User) *model.AppError
   402  	CheckUserPreflightAuthenticationCriteria(user *model.User, mfaToken string) *model.AppError
   403  	CheckValidDomains(team *model.Team) *model.AppError
   404  	ClearChannelMembersCache(channelID string)
   405  	ClearSessionCacheForAllUsers()
   406  	ClearSessionCacheForAllUsersSkipClusterSend()
   407  	ClearSessionCacheForUser(userId string)
   408  	ClearSessionCacheForUserSkipClusterSend(userId string)
   409  	ClearTeamMembersCache(teamID string)
   410  	ClientConfig() map[string]string
   411  	ClientConfigHash() string
   412  	Cloud() einterfaces.CloudInterface
   413  	Cluster() einterfaces.ClusterInterface
   414  	CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError)
   415  	CompareAndSetPluginKey(pluginId string, key string, oldValue, newValue []byte) (bool, *model.AppError)
   416  	CompleteOAuth(service string, body io.ReadCloser, teamId string, props map[string]string, tokenUser *model.User) (*model.User, *model.AppError)
   417  	CompleteSwitchWithOAuth(service string, userData io.Reader, email string, tokenUser *model.User) (*model.User, *model.AppError)
   418  	Compliance() einterfaces.ComplianceInterface
   419  	Config() *model.Config
   420  	Context() context.Context
   421  	CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)
   422  	CreateChannel(channel *model.Channel, addMember bool) (*model.Channel, *model.AppError)
   423  	CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channel, *model.AppError)
   424  	CreateCommand(cmd *model.Command) (*model.Command, *model.AppError)
   425  	CreateCommandWebhook(commandId string, args *model.CommandArgs) (*model.CommandWebhook, *model.AppError)
   426  	CreateEmoji(sessionUserId string, emoji *model.Emoji, multiPartImageData *multipart.Form) (*model.Emoji, *model.AppError)
   427  	CreateGroup(group *model.Group) (*model.Group, *model.AppError)
   428  	CreateGroupChannel(userIds []string, creatorId string) (*model.Channel, *model.AppError)
   429  	CreateIncomingWebhookForChannel(creatorId string, channel *model.Channel, hook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)
   430  	CreateJob(job *model.Job) (*model.Job, *model.AppError)
   431  	CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
   432  	CreateOAuthStateToken(extra string) (*model.Token, *model.AppError)
   433  	CreateOAuthUser(service string, userData io.Reader, teamId string, tokenUser *model.User) (*model.User, *model.AppError)
   434  	CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
   435  	CreatePasswordRecoveryToken(userId, email string) (*model.Token, *model.AppError)
   436  	CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks, setOnline bool) (savedPost *model.Post, err *model.AppError)
   437  	CreatePostAsUser(post *model.Post, currentSessionId string, setOnline bool) (*model.Post, *model.AppError)
   438  	CreatePostMissingChannel(post *model.Post, triggerWebhooks bool) (*model.Post, *model.AppError)
   439  	CreateRole(role *model.Role) (*model.Role, *model.AppError)
   440  	CreateScheme(scheme *model.Scheme) (*model.Scheme, *model.AppError)
   441  	CreateSession(session *model.Session) (*model.Session, *model.AppError)
   442  	CreateSidebarCategory(userId, teamId string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)
   443  	CreateTeam(team *model.Team) (*model.Team, *model.AppError)
   444  	CreateTeamWithUser(team *model.Team, userId string) (*model.Team, *model.AppError)
   445  	CreateTermsOfService(text, userId string) (*model.TermsOfService, *model.AppError)
   446  	CreateUploadSession(us *model.UploadSession) (*model.UploadSession, *model.AppError)
   447  	CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError)
   448  	CreateUserAsAdmin(user *model.User, redirect string) (*model.User, *model.AppError)
   449  	CreateUserFromSignup(user *model.User, redirect string) (*model.User, *model.AppError)
   450  	CreateUserWithInviteId(user *model.User, inviteId, redirect string) (*model.User, *model.AppError)
   451  	CreateUserWithToken(user *model.User, token *model.Token) (*model.User, *model.AppError)
   452  	CreateWebhookPost(userId string, channel *model.Channel, text, overrideUsername, overrideIconUrl, overrideIconEmoji string, props model.StringInterface, postType string, postRootId string) (*model.Post, *model.AppError)
   453  	DBHealthCheckDelete() error
   454  	DBHealthCheckWrite() error
   455  	DataRetention() einterfaces.DataRetentionInterface
   456  	DeactivateGuests() *model.AppError
   457  	DeactivateMfa(userId string) *model.AppError
   458  	DeauthorizeOAuthAppForUser(userId, appId string) *model.AppError
   459  	DeleteAllExpiredPluginKeys() *model.AppError
   460  	DeleteAllKeysForPlugin(pluginId string) *model.AppError
   461  	DeleteBrandImage() *model.AppError
   462  	DeleteChannel(channel *model.Channel, userId string) *model.AppError
   463  	DeleteCommand(commandId string) *model.AppError
   464  	DeleteEmoji(emoji *model.Emoji) *model.AppError
   465  	DeleteEphemeralPost(userId, postId string)
   466  	DeleteFlaggedPosts(postId string)
   467  	DeleteGroup(groupID string) (*model.Group, *model.AppError)
   468  	DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
   469  	DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
   470  	DeleteIncomingWebhook(hookId string) *model.AppError
   471  	DeleteOAuthApp(appId string) *model.AppError
   472  	DeleteOutgoingWebhook(hookId string) *model.AppError
   473  	DeletePluginKey(pluginId string, key string) *model.AppError
   474  	DeletePost(postId, deleteByID string) (*model.Post, *model.AppError)
   475  	DeletePostFiles(post *model.Post)
   476  	DeletePreferences(userId string, preferences model.Preferences) *model.AppError
   477  	DeleteReactionForPost(reaction *model.Reaction) *model.AppError
   478  	DeleteScheme(schemeId string) (*model.Scheme, *model.AppError)
   479  	DeleteSidebarCategory(userId, teamId, categoryId string) *model.AppError
   480  	DeleteToken(token *model.Token) *model.AppError
   481  	DisableAutoResponder(userId string, asAdmin bool) *model.AppError
   482  	DisableUserAccessToken(token *model.UserAccessToken) *model.AppError
   483  	DoAppMigrations()
   484  	DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command, *model.CommandResponse, *model.AppError)
   485  	DoEmojisPermissionsMigration()
   486  	DoGuestRolesCreationMigration()
   487  	DoLocalRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
   488  	DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string, isMobile, isOAuthUser, isSaml bool) *model.AppError
   489  	DoPostAction(postId, actionId, userId, selectedOption string) (string, *model.AppError)
   490  	DoPostActionWithCookie(postId, actionId, userId, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)
   491  	DoSystemConsoleRolesCreationMigration()
   492  	DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, *model.AppError)
   493  	DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)
   494  	DownloadFromURL(downloadURL string) ([]byte, error)
   495  	EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
   496  	EnvironmentConfig() map[string]interface{}
   497  	ExportPermissions(w io.Writer) error
   498  	FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
   499  	FileBackend() (filesstore.FileBackend, *model.AppError)
   500  	FileExists(path string) (bool, *model.AppError)
   501  	FileSize(path string) (int64, *model.AppError)
   502  	FillInChannelProps(channel *model.Channel) *model.AppError
   503  	FillInChannelsProps(channelList *model.ChannelList) *model.AppError
   504  	FilterUsersByVisible(viewer *model.User, otherUsers []*model.User) ([]*model.User, *model.AppError)
   505  	FindTeamByName(name string) bool
   506  	GenerateMfaSecret(userId string) (*model.MfaSecret, *model.AppError)
   507  	GeneratePublicLink(siteURL string, info *model.FileInfo) string
   508  	GetActivePluginManifests() ([]*model.Manifest, *model.AppError)
   509  	GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, *model.AppError)
   510  	GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.AppError)
   511  	GetAllPrivateTeams() ([]*model.Team, *model.AppError)
   512  	GetAllPrivateTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
   513  	GetAllPrivateTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
   514  	GetAllPublicTeams() ([]*model.Team, *model.AppError)
   515  	GetAllPublicTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
   516  	GetAllPublicTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
   517  	GetAllRoles() ([]*model.Role, *model.AppError)
   518  	GetAllStatuses() map[string]*model.Status
   519  	GetAllTeams() ([]*model.Team, *model.AppError)
   520  	GetAllTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
   521  	GetAllTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
   522  	GetAnalytics(name string, teamId string) (model.AnalyticsRows, *model.AppError)
   523  	GetAudits(userId string, limit int) (model.Audits, *model.AppError)
   524  	GetAuditsPage(userId string, page int, perPage int) (model.Audits, *model.AppError)
   525  	GetAuthorizationCode(w http.ResponseWriter, r *http.Request, service string, props map[string]string, loginHint string) (string, *model.AppError)
   526  	GetAuthorizedAppsForUser(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)
   527  	GetBrandImage() ([]byte, *model.AppError)
   528  	GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError)
   529  	GetChannel(channelId string) (*model.Channel, *model.AppError)
   530  	GetChannelByName(channelName, teamId string, includeDeleted bool) (*model.Channel, *model.AppError)
   531  	GetChannelByNameForTeamName(channelName, teamName string, includeDeleted bool) (*model.Channel, *model.AppError)
   532  	GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, *model.AppError)
   533  	GetChannelGuestCount(channelId string) (int64, *model.AppError)
   534  	GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError)
   535  	GetChannelMemberCount(channelId string) (int64, *model.AppError)
   536  	GetChannelMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, *model.AppError)
   537  	GetChannelMembersForUser(teamId string, userId string) (*model.ChannelMembers, *model.AppError)
   538  	GetChannelMembersForUserWithPagination(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)
   539  	GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)
   540  	GetChannelMembersTimezones(channelId string) ([]string, *model.AppError)
   541  	GetChannelPinnedPostCount(channelId string) (int64, *model.AppError)
   542  	GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError)
   543  	GetChannelsByNames(channelNames []string, teamId string) ([]*model.Channel, *model.AppError)
   544  	GetChannelsForScheme(scheme *model.Scheme, offset int, limit int) (model.ChannelList, *model.AppError)
   545  	GetChannelsForSchemePage(scheme *model.Scheme, page int, perPage int) (model.ChannelList, *model.AppError)
   546  	GetChannelsForUser(teamId string, userId string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, *model.AppError)
   547  	GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (*model.ChannelList, *model.AppError)
   548  	GetCloudSession(token string) (*model.Session, *model.AppError)
   549  	GetClusterId() string
   550  	GetClusterStatus() []*model.ClusterInfo
   551  	GetCommand(commandId string) (*model.Command, *model.AppError)
   552  	GetComplianceFile(job *model.Compliance) ([]byte, *model.AppError)
   553  	GetComplianceReport(reportId string) (*model.Compliance, *model.AppError)
   554  	GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError)
   555  	GetCookieDomain() string
   556  	GetDataRetentionPolicy() (*model.DataRetentionPolicy, *model.AppError)
   557  	GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError)
   558  	GetDeletedChannels(teamId string, offset int, limit int, userId string) (*model.ChannelList, *model.AppError)
   559  	GetEmoji(emojiId string) (*model.Emoji, *model.AppError)
   560  	GetEmojiByName(emojiName string) (*model.Emoji, *model.AppError)
   561  	GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)
   562  	GetEmojiList(page, perPage int, sort string) ([]*model.Emoji, *model.AppError)
   563  	GetErrorListForEmailsOverLimit(emailList []string, cloudUserLimit int64) ([]string, []*model.EmailInviteWithError, *model.AppError)
   564  	GetFile(fileId string) ([]byte, *model.AppError)
   565  	GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)
   566  	GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)
   567  	GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError)
   568  	GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError)
   569  	GetFlaggedPosts(userId string, offset int, limit int) (*model.PostList, *model.AppError)
   570  	GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) (*model.PostList, *model.AppError)
   571  	GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) (*model.PostList, *model.AppError)
   572  	GetGroup(id string) (*model.Group, *model.AppError)
   573  	GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError)
   574  	GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError)
   575  	GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)
   576  	GetGroupMemberCount(groupID string) (int64, *model.AppError)
   577  	GetGroupMemberUsers(groupID string) ([]*model.User, *model.AppError)
   578  	GetGroupMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, int, *model.AppError)
   579  	GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
   580  	GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)
   581  	GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError)
   582  	GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError)
   583  	GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)
   584  	GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError)
   585  	GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError)
   586  	GetGroupsByUserId(userId string) ([]*model.Group, *model.AppError)
   587  	GetHubForUserId(userId string) *Hub
   588  	GetIncomingWebhook(hookId string) (*model.IncomingWebhook, *model.AppError)
   589  	GetIncomingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
   590  	GetIncomingWebhooksForTeamPageByUser(teamId string, userId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
   591  	GetIncomingWebhooksPage(page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
   592  	GetIncomingWebhooksPageByUser(userId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
   593  	GetJob(id string) (*model.Job, *model.AppError)
   594  	GetJobs(offset int, limit int) ([]*model.Job, *model.AppError)
   595  	GetJobsByType(jobType string, offset int, limit int) ([]*model.Job, *model.AppError)
   596  	GetJobsByTypePage(jobType string, page int, perPage int) ([]*model.Job, *model.AppError)
   597  	GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError)
   598  	GetLatestTermsOfService() (*model.TermsOfService, *model.AppError)
   599  	GetLogs(page, perPage int) ([]string, *model.AppError)
   600  	GetLogsSkipSend(page, perPage int) ([]string, *model.AppError)
   601  	GetMemberCountsByGroup(channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, *model.AppError)
   602  	GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string
   603  	GetMultipleEmojiByName(names []string) ([]*model.Emoji, *model.AppError)
   604  	GetNewUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   605  	GetNextPostIdFromPostList(postList *model.PostList) string
   606  	GetNotificationNameFormat(user *model.User) string
   607  	GetNumberOfChannelsOnTeam(teamId string) (int, *model.AppError)
   608  	GetOAuthAccessTokenForCodeFlow(clientId, grantType, redirectUri, code, secret, refreshToken string) (*model.AccessResponse, *model.AppError)
   609  	GetOAuthAccessTokenForImplicitFlow(userId string, authRequest *model.AuthorizeRequest) (*model.Session, *model.AppError)
   610  	GetOAuthApp(appId string) (*model.OAuthApp, *model.AppError)
   611  	GetOAuthApps(page, perPage int) ([]*model.OAuthApp, *model.AppError)
   612  	GetOAuthAppsByCreator(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)
   613  	GetOAuthCodeRedirect(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)
   614  	GetOAuthImplicitRedirect(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)
   615  	GetOAuthLoginEndpoint(w http.ResponseWriter, r *http.Request, service, teamId, action, redirectTo, loginHint string, isMobile bool) (string, *model.AppError)
   616  	GetOAuthSignupEndpoint(w http.ResponseWriter, r *http.Request, service, teamId string) (string, *model.AppError)
   617  	GetOAuthStateToken(token string) (*model.Token, *model.AppError)
   618  	GetOpenGraphMetadata(requestURL string) *opengraph.OpenGraph
   619  	GetOrCreateDirectChannel(userId, otherUserId string) (*model.Channel, *model.AppError)
   620  	GetOutgoingWebhook(hookId string) (*model.OutgoingWebhook, *model.AppError)
   621  	GetOutgoingWebhooksForChannelPageByUser(channelId string, userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
   622  	GetOutgoingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
   623  	GetOutgoingWebhooksForTeamPageByUser(teamId string, userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
   624  	GetOutgoingWebhooksPage(page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
   625  	GetOutgoingWebhooksPageByUser(userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
   626  	GetPasswordRecoveryToken(token string) (*model.Token, *model.AppError)
   627  	GetPermalinkPost(postId string, userId string) (*model.PostList, *model.AppError)
   628  	GetPinnedPosts(channelId string) (*model.PostList, *model.AppError)
   629  	GetPluginKey(pluginId string, key string) ([]byte, *model.AppError)
   630  	GetPlugins() (*model.PluginsResponse, *model.AppError)
   631  	GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError)
   632  	GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError)
   633  	GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError)
   634  	GetPostThread(postId string, skipFetchThreads bool) (*model.PostList, *model.AppError)
   635  	GetPosts(channelId string, offset int, limit int) (*model.PostList, *model.AppError)
   636  	GetPostsAfterPost(options model.GetPostsOptions) (*model.PostList, *model.AppError)
   637  	GetPostsAroundPost(before bool, options model.GetPostsOptions) (*model.PostList, *model.AppError)
   638  	GetPostsBeforePost(options model.GetPostsOptions) (*model.PostList, *model.AppError)
   639  	GetPostsEtag(channelId string) string
   640  	GetPostsForChannelAroundLastUnread(channelId, userId string, limitBefore, limitAfter int, skipFetchThreads bool) (*model.PostList, *model.AppError)
   641  	GetPostsPage(options model.GetPostsOptions) (*model.PostList, *model.AppError)
   642  	GetPostsSince(options model.GetPostsSinceOptions) (*model.PostList, *model.AppError)
   643  	GetPreferenceByCategoryAndNameForUser(userId string, category string, preferenceName string) (*model.Preference, *model.AppError)
   644  	GetPreferenceByCategoryForUser(userId string, category string) (model.Preferences, *model.AppError)
   645  	GetPreferencesForUser(userId string) (model.Preferences, *model.AppError)
   646  	GetPrevPostIdFromPostList(postList *model.PostList) string
   647  	GetPrivateChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)
   648  	GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
   649  	GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*model.ChannelList, *model.AppError)
   650  	GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)
   651  	GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError)
   652  	GetRecentlyActiveUsersForTeam(teamId string) (map[string]*model.User, *model.AppError)
   653  	GetRecentlyActiveUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   654  	GetRole(id string) (*model.Role, *model.AppError)
   655  	GetRoleByName(name string) (*model.Role, *model.AppError)
   656  	GetRolesByNames(names []string) ([]*model.Role, *model.AppError)
   657  	GetSamlCertificateStatus() *model.SamlCertificateStatus
   658  	GetSamlMetadata() (string, *model.AppError)
   659  	GetSamlMetadataFromIdp(idpMetadataUrl string) (*model.SamlMetadataResponse, *model.AppError)
   660  	GetSanitizeOptions(asAdmin bool) map[string]bool
   661  	GetScheme(id string) (*model.Scheme, *model.AppError)
   662  	GetSchemeByName(name string) (*model.Scheme, *model.AppError)
   663  	GetSchemeRolesForTeam(teamId string) (string, string, string, *model.AppError)
   664  	GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError)
   665  	GetSchemesPage(scope string, page int, perPage int) ([]*model.Scheme, *model.AppError)
   666  	GetSession(token string) (*model.Session, *model.AppError)
   667  	GetSessionById(sessionId string) (*model.Session, *model.AppError)
   668  	GetSessions(userId string) ([]*model.Session, *model.AppError)
   669  	GetSidebarCategories(userId, teamId string) (*model.OrderedSidebarCategories, *model.AppError)
   670  	GetSidebarCategory(categoryId string) (*model.SidebarCategoryWithChannels, *model.AppError)
   671  	GetSidebarCategoryOrder(userId, teamId string) ([]string, *model.AppError)
   672  	GetSinglePost(postId string) (*model.Post, *model.AppError)
   673  	GetSiteURL() string
   674  	GetStatus(userId string) (*model.Status, *model.AppError)
   675  	GetStatusFromCache(userId string) *model.Status
   676  	GetStatusesByIds(userIds []string) (map[string]interface{}, *model.AppError)
   677  	GetT() goi18n.TranslateFunc
   678  	GetTeam(teamId string) (*model.Team, *model.AppError)
   679  	GetTeamByInviteId(inviteId string) (*model.Team, *model.AppError)
   680  	GetTeamByName(name string) (*model.Team, *model.AppError)
   681  	GetTeamIcon(team *model.Team) ([]byte, *model.AppError)
   682  	GetTeamIdFromQuery(query url.Values) (string, *model.AppError)
   683  	GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
   684  	GetTeamMembers(teamId string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, *model.AppError)
   685  	GetTeamMembersByIds(teamId string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, *model.AppError)
   686  	GetTeamMembersForUser(userId string) ([]*model.TeamMember, *model.AppError)
   687  	GetTeamMembersForUserWithPagination(userId string, page, perPage int) ([]*model.TeamMember, *model.AppError)
   688  	GetTeamStats(teamId string, restrictions *model.ViewUsersRestrictions) (*model.TeamStats, *model.AppError)
   689  	GetTeamUnread(teamId, userId string) (*model.TeamUnread, *model.AppError)
   690  	GetTeamsForScheme(scheme *model.Scheme, offset int, limit int) ([]*model.Team, *model.AppError)
   691  	GetTeamsForSchemePage(scheme *model.Scheme, page int, perPage int) ([]*model.Team, *model.AppError)
   692  	GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)
   693  	GetTeamsUnreadForUser(excludeTeamId string, userId string) ([]*model.TeamUnread, *model.AppError)
   694  	GetTermsOfService(id string) (*model.TermsOfService, *model.AppError)
   695  	GetThreadMembershipsForUser(userId, teamId string) ([]*model.ThreadMembership, error)
   696  	GetThreadsForUser(userId, teamId string, options model.GetUserThreadsOpts) (*model.Threads, *model.AppError)
   697  	GetUploadSession(uploadId string) (*model.UploadSession, *model.AppError)
   698  	GetUploadSessionsForUser(userId string) ([]*model.UploadSession, *model.AppError)
   699  	GetUser(userId string) (*model.User, *model.AppError)
   700  	GetUserAccessToken(tokenId string, sanitize bool) (*model.UserAccessToken, *model.AppError)
   701  	GetUserAccessTokens(page, perPage int) ([]*model.UserAccessToken, *model.AppError)
   702  	GetUserAccessTokensForUser(userId string, page, perPage int) ([]*model.UserAccessToken, *model.AppError)
   703  	GetUserByAuth(authData *string, authService string) (*model.User, *model.AppError)
   704  	GetUserByEmail(email string) (*model.User, *model.AppError)
   705  	GetUserByUsername(username string) (*model.User, *model.AppError)
   706  	GetUserForLogin(id, loginId string) (*model.User, *model.AppError)
   707  	GetUserTermsOfService(userId string) (*model.UserTermsOfService, *model.AppError)
   708  	GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)
   709  	GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError)
   710  	GetUsersByIds(userIds []string, options *store.UserGetByIdsOpts) ([]*model.User, *model.AppError)
   711  	GetUsersByUsernames(usernames []string, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   712  	GetUsersEtag(restrictionsHash string) string
   713  	GetUsersInChannel(options *model.UserGetOptions) ([]*model.User, *model.AppError)
   714  	GetUsersInChannelByStatus(options *model.UserGetOptions) ([]*model.User, *model.AppError)
   715  	GetUsersInChannelMap(options *model.UserGetOptions, asAdmin bool) (map[string]*model.User, *model.AppError)
   716  	GetUsersInChannelPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
   717  	GetUsersInChannelPageByStatus(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
   718  	GetUsersInTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError)
   719  	GetUsersInTeamEtag(teamId string, restrictionsHash string) string
   720  	GetUsersInTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
   721  	GetUsersNotInChannel(teamId string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   722  	GetUsersNotInChannelMap(teamId string, channelId string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError)
   723  	GetUsersNotInChannelPage(teamId string, channelId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   724  	GetUsersNotInTeam(teamId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   725  	GetUsersNotInTeamEtag(teamId string, restrictionsHash string) string
   726  	GetUsersNotInTeamPage(teamId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
   727  	GetUsersPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
   728  	GetUsersWithoutTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError)
   729  	GetUsersWithoutTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
   730  	GetVerifyEmailToken(token string) (*model.Token, *model.AppError)
   731  	GetViewUsersRestrictions(userId string) (*model.ViewUsersRestrictions, *model.AppError)
   732  	GetWarnMetricsStatus() (map[string]*model.WarnMetricStatus, *model.AppError)
   733  	HTTPService() httpservice.HTTPService
   734  	Handle404(w http.ResponseWriter, r *http.Request)
   735  	HandleCommandResponse(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError)
   736  	HandleCommandResponsePost(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.Post, *model.AppError)
   737  	HandleCommandWebhook(hookId string, response *model.CommandResponse) *model.AppError
   738  	HandleImages(previewPathList []string, thumbnailPathList []string, fileData [][]byte)
   739  	HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest) *model.AppError
   740  	HandleMessageExportConfig(cfg *model.Config, appCfg *model.Config)
   741  	HasPermissionTo(askingUserId string, permission *model.Permission) bool
   742  	HasPermissionToChannel(askingUserId string, channelId string, permission *model.Permission) bool
   743  	HasPermissionToChannelByPost(askingUserId string, postId string, permission *model.Permission) bool
   744  	HasPermissionToTeam(askingUserId string, teamId string, permission *model.Permission) bool
   745  	HasPermissionToUser(askingUserId string, userId string) bool
   746  	HubStop()
   747  	ImageProxy() *imageproxy.ImageProxy
   748  	ImageProxyAdder() func(string) string
   749  	ImageProxyRemover() (f func(string) string)
   750  	ImportPermissions(jsonl io.Reader) error
   751  	InitPlugins(pluginDir, webappPluginDir string)
   752  	InitPostMetadata()
   753  	InitServer()
   754  	InstallPluginFromData(data model.PluginEventData)
   755  	InvalidateAllEmailInvites() *model.AppError
   756  	InvalidateCacheForUser(userId string)
   757  	InvalidateWebConnSessionCacheForUser(userId string)
   758  	InviteGuestsToChannels(teamId string, guestsInvite *model.GuestsInvite, senderId string) *model.AppError
   759  	InviteGuestsToChannelsGracefully(teamId string, guestsInvite *model.GuestsInvite, senderId string) ([]*model.EmailInviteWithError, *model.AppError)
   760  	InviteNewUsersToTeam(emailList []string, teamId, senderId string) *model.AppError
   761  	InviteNewUsersToTeamGracefully(emailList []string, teamId, senderId string) ([]*model.EmailInviteWithError, *model.AppError)
   762  	IpAddress() string
   763  	IsFirstUserAccount() bool
   764  	IsLeader() bool
   765  	IsPasswordValid(password string) *model.AppError
   766  	IsPhase2MigrationCompleted() *model.AppError
   767  	IsUserAway(lastActivityAt int64) bool
   768  	IsUserSignUpAllowed() *model.AppError
   769  	JoinChannel(channel *model.Channel, userId string) *model.AppError
   770  	JoinDefaultChannels(teamId string, user *model.User, shouldBeAdmin bool, userRequestorId string) *model.AppError
   771  	JoinUserToTeam(team *model.Team, user *model.User, userRequestorId string) *model.AppError
   772  	Ldap() einterfaces.LdapInterface
   773  	LeaveChannel(channelId string, userId string) *model.AppError
   774  	LeaveTeam(team *model.Team, user *model.User, requestorId string) *model.AppError
   775  	LimitedClientConfig() map[string]string
   776  	ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
   777  	ListDirectory(path string) ([]string, *model.AppError)
   778  	ListImports() ([]string, *model.AppError)
   779  	ListPluginKeys(pluginId string, page, perPage int) ([]string, *model.AppError)
   780  	ListTeamCommands(teamId string) ([]*model.Command, *model.AppError)
   781  	Log() *mlog.Logger
   782  	LoginByOAuth(service string, userData io.Reader, teamId string, tokenUser *model.User) (*model.User, *model.AppError)
   783  	MakePermissionError(permissions []*model.Permission) *model.AppError
   784  	MarkChannelsAsViewed(channelIds []string, userId string, currentSessionId string) (map[string]int64, *model.AppError)
   785  	MaxPostSize() int
   786  	MessageExport() einterfaces.MessageExportInterface
   787  	Metrics() einterfaces.MetricsInterface
   788  	MigrateIdLDAP(toAttribute string) *model.AppError
   789  	MoveCommand(team *model.Team, command *model.Command) *model.AppError
   790  	MoveFile(oldPath, newPath string) *model.AppError
   791  	NewClusterDiscoveryService() *ClusterDiscoveryService
   792  	NewPluginAPI(manifest *model.Manifest) plugin.API
   793  	Notification() einterfaces.NotificationInterface
   794  	NotificationsLog() *mlog.Logger
   795  	NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User, forceAck bool, isBot bool) *model.AppError
   796  	OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError
   797  	OriginChecker() func(*http.Request) bool
   798  	PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userId string) (*model.Channel, *model.AppError)
   799  	PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError)
   800  	PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError)
   801  	PatchScheme(scheme *model.Scheme, patch *model.SchemePatch) (*model.Scheme, *model.AppError)
   802  	PatchTeam(teamId string, patch *model.TeamPatch) (*model.Team, *model.AppError)
   803  	PatchUser(userId string, patch *model.UserPatch, asAdmin bool) (*model.User, *model.AppError)
   804  	Path() string
   805  	PermanentDeleteAllUsers() *model.AppError
   806  	PermanentDeleteChannel(channel *model.Channel) *model.AppError
   807  	PermanentDeleteTeam(team *model.Team) *model.AppError
   808  	PermanentDeleteTeamId(teamId string) *model.AppError
   809  	PermanentDeleteUser(user *model.User) *model.AppError
   810  	PluginCommandsForTeam(teamId string) []*model.Command
   811  	PluginContext() *plugin.Context
   812  	PostActionCookieSecret() []byte
   813  	PostAddToChannelMessage(user *model.User, addedUser *model.User, channel *model.Channel, postRootId string) *model.AppError
   814  	PostPatchWithProxyRemovedFromImageURLs(patch *model.PostPatch) *model.PostPatch
   815  	PostUpdateChannelDisplayNameMessage(userId string, channel *model.Channel, oldChannelDisplayName, newChannelDisplayName string) *model.AppError
   816  	PostUpdateChannelHeaderMessage(userId string, channel *model.Channel, oldChannelHeader, newChannelHeader string) *model.AppError
   817  	PostUpdateChannelPurposeMessage(userId string, channel *model.Channel, oldChannelPurpose string, newChannelPurpose string) *model.AppError
   818  	PostWithProxyAddedToImageURLs(post *model.Post) *model.Post
   819  	PostWithProxyRemovedFromImageURLs(post *model.Post) *model.Post
   820  	PreparePostForClient(originalPost *model.Post, isNewPost bool, isEditPost bool) *model.Post
   821  	PreparePostListForClient(originalList *model.PostList) *model.PostList
   822  	ProcessSlackText(text string) string
   823  	Publish(message *model.WebSocketEvent)
   824  	PublishSkipClusterSend(message *model.WebSocketEvent)
   825  	PublishUserTyping(userId, channelId, parentId string) *model.AppError
   826  	PurgeBleveIndexes() *model.AppError
   827  	PurgeElasticsearchIndexes() *model.AppError
   828  	ReadFile(path string) ([]byte, *model.AppError)
   829  	RecycleDatabaseConnection()
   830  	RegenCommandToken(cmd *model.Command) (*model.Command, *model.AppError)
   831  	RegenOutgoingWebhookToken(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
   832  	RegenerateOAuthAppSecret(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
   833  	RegenerateTeamInviteId(teamId string) (*model.Team, *model.AppError)
   834  	RegisterPluginCommand(pluginId string, command *model.Command) error
   835  	ReloadConfig() error
   836  	RemoveAllDeactivatedMembersFromChannel(channel *model.Channel) *model.AppError
   837  	RemoveConfigListener(id string)
   838  	RemoveDirectory(path string) *model.AppError
   839  	RemoveFile(path string) *model.AppError
   840  	RemoveLdapPrivateCertificate() *model.AppError
   841  	RemoveLdapPublicCertificate() *model.AppError
   842  	RemovePlugin(id string) *model.AppError
   843  	RemovePluginFromData(data model.PluginEventData)
   844  	RemoveSamlIdpCertificate() *model.AppError
   845  	RemoveSamlPrivateCertificate() *model.AppError
   846  	RemoveSamlPublicCertificate() *model.AppError
   847  	RemoveTeamIcon(teamId string) *model.AppError
   848  	RemoveTeamMemberFromTeam(teamMember *model.TeamMember, requestorId string) *model.AppError
   849  	RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError
   850  	RemoveUserFromTeam(teamId string, userId string, requestorId string) *model.AppError
   851  	RemoveUsersFromChannelNotMemberOfTeam(remover *model.User, channel *model.Channel, team *model.Team) *model.AppError
   852  	RequestId() string
   853  	RequestLicenseAndAckWarnMetric(warnMetricId string, isBot bool) *model.AppError
   854  	ResetPasswordFromToken(userSuppliedTokenString, newPassword string) *model.AppError
   855  	ResetPermissionsSystem() *model.AppError
   856  	RestoreChannel(channel *model.Channel, userId string) (*model.Channel, *model.AppError)
   857  	RestoreTeam(teamId string) *model.AppError
   858  	RestrictUsersGetByPermissions(userId string, options *model.UserGetOptions) (*model.UserGetOptions, *model.AppError)
   859  	RestrictUsersSearchByPermissions(userId string, options *model.UserSearchOptions) (*model.UserSearchOptions, *model.AppError)
   860  	RevokeAccessToken(token string) *model.AppError
   861  	RevokeAllSessions(userId string) *model.AppError
   862  	RevokeSession(session *model.Session) *model.AppError
   863  	RevokeSessionById(sessionId string) *model.AppError
   864  	RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError
   865  	RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError
   866  	RolesGrantPermission(roleNames []string, permissionId string) bool
   867  	Saml() einterfaces.SamlInterface
   868  	SanitizeProfile(user *model.User, asAdmin bool)
   869  	SanitizeTeam(session model.Session, team *model.Team) *model.Team
   870  	SanitizeTeams(session model.Session, teams []*model.Team) []*model.Team
   871  	SaveAndBroadcastStatus(status *model.Status)
   872  	SaveBrandImage(imageData *multipart.FileHeader) *model.AppError
   873  	SaveComplianceReport(job *model.Compliance) (*model.Compliance, *model.AppError)
   874  	SaveReactionForPost(reaction *model.Reaction) (*model.Reaction, *model.AppError)
   875  	SaveUserTermsOfService(userId, termsOfServiceId string, accepted bool) *model.AppError
   876  	SchemesIterator(scope string, batchSize int) func() []*model.Scheme
   877  	SearchArchivedChannels(teamId string, term string, userId string) (*model.ChannelList, *model.AppError)
   878  	SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
   879  	SearchChannelsForUser(userId, teamId, term string) (*model.ChannelList, *model.AppError)
   880  	SearchChannelsUserNotIn(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)
   881  	SearchEmoji(name string, prefixOnly bool, limit int) ([]*model.Emoji, *model.AppError)
   882  	SearchEngine() *searchengine.Broker
   883  	SearchGroupChannels(userId, term string) (*model.ChannelList, *model.AppError)
   884  	SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) (*model.PostList, *model.AppError)
   885  	SearchPostsInTeamForUser(terms string, userId string, teamId string, isOrSearch bool, includeDeletedChannels bool, timeZoneOffset int, page, perPage int) (*model.PostSearchResults, *model.AppError)
   886  	SearchPrivateTeams(term string) ([]*model.Team, *model.AppError)
   887  	SearchPublicTeams(term string) ([]*model.Team, *model.AppError)
   888  	SearchUserAccessTokens(term string) ([]*model.UserAccessToken, *model.AppError)
   889  	SearchUsers(props *model.UserSearch, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   890  	SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   891  	SearchUsersInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   892  	SearchUsersInTeam(teamId, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   893  	SearchUsersNotInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   894  	SearchUsersNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   895  	SearchUsersWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
   896  	SendAckToPushProxy(ack *model.PushNotificationAck) error
   897  	SendAutoResponse(channel *model.Channel, receiver *model.User, post *model.Post) (bool, *model.AppError)
   898  	SendAutoResponseIfNecessary(channel *model.Channel, sender *model.User, post *model.Post) (bool, *model.AppError)
   899  	SendEmailVerification(user *model.User, newEmail, redirect string) *model.AppError
   900  	SendEphemeralPost(userId string, post *model.Post) *model.Post
   901  	SendNotifications(post *model.Post, team *model.Team, channel *model.Channel, sender *model.User, parentPostList *model.PostList, setOnline bool) ([]string, error)
   902  	SendPasswordReset(email string, siteURL string) (bool, *model.AppError)
   903  	SendPaymentFailedEmail(failedPayment *model.FailedPayment) *model.AppError
   904  	ServeInterPluginRequest(w http.ResponseWriter, r *http.Request, sourcePluginId, destinationPluginId string)
   905  	ServePluginRequest(w http.ResponseWriter, r *http.Request)
   906  	Session() *model.Session
   907  	SessionCacheLength() int
   908  	SessionHasPermissionTo(session model.Session, permission *model.Permission) bool
   909  	SessionHasPermissionToAny(session model.Session, permissions []*model.Permission) bool
   910  	SessionHasPermissionToCategory(session model.Session, userId, teamId, categoryId string) bool
   911  	SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool
   912  	SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool
   913  	SessionHasPermissionToTeam(session model.Session, teamId string, permission *model.Permission) bool
   914  	SessionHasPermissionToUser(session model.Session, userId string) bool
   915  	SessionHasPermissionToUserOrBot(session model.Session, userId string) bool
   916  	SetAcceptLanguage(s string)
   917  	SetActiveChannel(userId string, channelId string) *model.AppError
   918  	SetAutoResponderStatus(user *model.User, oldNotifyProps model.StringMap)
   919  	SetContext(c context.Context)
   920  	SetDefaultProfileImage(user *model.User) *model.AppError
   921  	SetIpAddress(s string)
   922  	SetPath(s string)
   923  	SetPhase2PermissionsMigrationStatus(isComplete bool) error
   924  	SetPluginKey(pluginId string, key string, value []byte) *model.AppError
   925  	SetPluginKeyWithExpiry(pluginId string, key string, value []byte, expireInSeconds int64) *model.AppError
   926  	SetPluginKeyWithOptions(pluginId string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
   927  	SetPluginsEnvironment(pluginsEnvironment *plugin.Environment)
   928  	SetProfileImage(userId string, imageData *multipart.FileHeader) *model.AppError
   929  	SetProfileImageFromFile(userId string, file io.Reader) *model.AppError
   930  	SetProfileImageFromMultiPartFile(userId string, file multipart.File) *model.AppError
   931  	SetRequestId(s string)
   932  	SetSamlIdpCertificateFromMetadata(data []byte) *model.AppError
   933  	SetSearchEngine(se *searchengine.Broker)
   934  	SetServer(srv *Server)
   935  	SetSession(s *model.Session)
   936  	SetStatusAwayIfNeeded(userId string, manual bool)
   937  	SetStatusDoNotDisturb(userId string)
   938  	SetStatusOffline(userId string, manual bool)
   939  	SetStatusOnline(userId string, manual bool)
   940  	SetStatusOutOfOffice(userId string)
   941  	SetT(t goi18n.TranslateFunc)
   942  	SetTeamIcon(teamId string, imageData *multipart.FileHeader) *model.AppError
   943  	SetTeamIconFromFile(team *model.Team, file io.Reader) *model.AppError
   944  	SetTeamIconFromMultiPartFile(teamId string, file multipart.File) *model.AppError
   945  	SetUserAgent(s string)
   946  	SlackImport(fileData multipart.File, fileSize int64, teamID string) (*model.AppError, *bytes.Buffer)
   947  	SoftDeleteTeam(teamId string) *model.AppError
   948  	Srv() *Server
   949  	SubmitInteractiveDialog(request model.SubmitDialogRequest) (*model.SubmitDialogResponse, *model.AppError)
   950  	SwitchEmailToLdap(email, password, code, ldapLoginId, ldapPassword string) (string, *model.AppError)
   951  	SwitchEmailToOAuth(w http.ResponseWriter, r *http.Request, email, password, code, service string) (string, *model.AppError)
   952  	SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (string, *model.AppError)
   953  	SwitchOAuthToEmail(email, password, requesterId string) (string, *model.AppError)
   954  	SyncLdap()
   955  	SyncPluginsActiveState()
   956  	T(translationID string, args ...interface{}) string
   957  	TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError)
   958  	TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError)
   959  	TelemetryId() string
   960  	TestElasticsearch(cfg *model.Config) *model.AppError
   961  	TestEmail(userId string, cfg *model.Config) *model.AppError
   962  	TestFilesStoreConnection() *model.AppError
   963  	TestFilesStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError
   964  	TestLdap() *model.AppError
   965  	TestSiteURL(siteURL string) *model.AppError
   966  	Timezones() *timezones.Timezones
   967  	ToggleMuteChannel(channelId, userId string) (*model.ChannelMember, *model.AppError)
   968  	TotalWebsocketConnections() int
   969  	TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model.OutgoingWebhook, post *model.Post, channel *model.Channel)
   970  	UnregisterPluginCommand(pluginId, teamId, trigger string)
   971  	UnregisterPluginCommands(pluginId string)
   972  	UpdateActive(user *model.User, active bool) (*model.User, *model.AppError)
   973  	UpdateChannelLastViewedAt(channelIds []string, userId string) *model.AppError
   974  	UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userId string) (*model.ChannelMember, *model.AppError)
   975  	UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError)
   976  	UpdateChannelMemberSchemeRoles(channelId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError)
   977  	UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError)
   978  	UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError)
   979  	UpdateConfig(f func(*model.Config))
   980  	UpdateEphemeralPost(userId string, post *model.Post) *model.Post
   981  	UpdateGroup(group *model.Group) (*model.Group, *model.AppError)
   982  	UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
   983  	UpdateHashedPassword(user *model.User, newHashedPassword string) *model.AppError
   984  	UpdateHashedPasswordByUserId(userId, newHashedPassword string) *model.AppError
   985  	UpdateIncomingWebhook(oldHook, updatedHook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)
   986  	UpdateLastActivityAtIfNeeded(session model.Session)
   987  	UpdateMfa(activate bool, userId, token string) *model.AppError
   988  	UpdateMobileAppBadge(userId string)
   989  	UpdateOAuthUserAttrs(userData io.Reader, user *model.User, provider einterfaces.OauthProvider, service string, tokenUser *model.User) *model.AppError
   990  	UpdateOauthApp(oldApp, updatedApp *model.OAuthApp) (*model.OAuthApp, *model.AppError)
   991  	UpdateOutgoingWebhook(oldHook, updatedHook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
   992  	UpdatePassword(user *model.User, newPassword string) *model.AppError
   993  	UpdatePasswordAsUser(userId, currentPassword, newPassword string) *model.AppError
   994  	UpdatePasswordByUserIdSendEmail(userId, newPassword, method string) *model.AppError
   995  	UpdatePasswordSendEmail(user *model.User, newPassword, method string) *model.AppError
   996  	UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model.AppError)
   997  	UpdatePreferences(userId string, preferences model.Preferences) *model.AppError
   998  	UpdateRole(role *model.Role) (*model.Role, *model.AppError)
   999  	UpdateScheme(scheme *model.Scheme) (*model.Scheme, *model.AppError)
  1000  	UpdateSessionsIsGuest(userId string, isGuest bool)
  1001  	UpdateSidebarCategories(userId, teamId string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)
  1002  	UpdateSidebarCategoryOrder(userId, teamId string, categoryOrder []string) *model.AppError
  1003  	UpdateTeam(team *model.Team) (*model.Team, *model.AppError)
  1004  	UpdateTeamMemberRoles(teamId string, userId string, newRoles string) (*model.TeamMember, *model.AppError)
  1005  	UpdateTeamMemberSchemeRoles(teamId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.TeamMember, *model.AppError)
  1006  	UpdateTeamPrivacy(teamId string, teamType string, allowOpenInvite bool) *model.AppError
  1007  	UpdateTeamScheme(team *model.Team) (*model.Team, *model.AppError)
  1008  	UpdateThreadFollowForUser(userId, threadId string, state bool) *model.AppError
  1009  	UpdateThreadReadForUser(userId, teamId, threadId string, timestamp int64) *model.AppError
  1010  	UpdateThreadsReadForUser(userId, teamId string) *model.AppError
  1011  	UpdateUser(user *model.User, sendNotifications bool) (*model.User, *model.AppError)
  1012  	UpdateUserActive(userId string, active bool) *model.AppError
  1013  	UpdateUserAsUser(user *model.User, asAdmin bool) (*model.User, *model.AppError)
  1014  	UpdateUserAuth(userId string, userAuth *model.UserAuth) (*model.UserAuth, *model.AppError)
  1015  	UpdateUserNotifyProps(userId string, props map[string]string) (*model.User, *model.AppError)
  1016  	UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError)
  1017  	UploadData(us *model.UploadSession, rd io.Reader) (*model.FileInfo, *model.AppError)
  1018  	UploadEmojiImage(id string, imageData *multipart.FileHeader) *model.AppError
  1019  	UploadMultipartFiles(teamId string, channelId string, userId string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
  1020  	UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
  1021  	UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
  1022  	UserAgent() string
  1023  	UserCanSeeOtherUser(userId string, otherUserId string) (bool, *model.AppError)
  1024  	VerifyEmailFromToken(userSuppliedTokenString string) *model.AppError
  1025  	VerifyUserEmail(userId, email string) *model.AppError
  1026  	ViewChannel(view *model.ChannelView, userId string, currentSessionId string) (map[string]int64, *model.AppError)
  1027  	WaitForChannelMembership(channelId string, userId string)
  1028  	WriteFile(fr io.Reader, path string) (int64, *model.AppError)
  1029  }