2017-10-25 11:33:19 -05:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
2019-11-29 12:59:40 +01:00
|
|
|
// See LICENSE.txt for license information.
|
2017-10-25 11:33:19 -05:00
|
|
|
|
2017-08-16 17:23:38 -05:00
|
|
|
package plugin
|
|
|
|
|
|
2017-08-28 14:19:00 -05:00
|
|
|
import (
|
2019-10-17 20:57:55 +02:00
|
|
|
"io"
|
2019-11-04 17:35:58 -08:00
|
|
|
"net/http"
|
2019-10-17 20:57:55 +02:00
|
|
|
|
2018-11-19 15:27:17 -05:00
|
|
|
plugin "github.com/hashicorp/go-plugin"
|
2019-11-28 14:39:38 +01:00
|
|
|
"github.com/mattermost/mattermost-server/v5/model"
|
2017-08-28 14:19:00 -05:00
|
|
|
)
|
|
|
|
|
|
2017-11-03 11:34:44 -05:00
|
|
|
// 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.
|
|
|
|
|
//
|
2018-07-13 10:29:50 -04:00
|
|
|
// Plugins obtain access to the API by embedding MattermostPlugin and accessing the API member
|
|
|
|
|
// directly.
|
2017-08-16 17:23:38 -05:00
|
|
|
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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-08-16 17:23:38 -05:00
|
|
|
LoadPluginConfiguration(dest interface{}) error
|
2017-08-28 14:19:00 -05:00
|
|
|
|
2017-12-08 13:55:41 -06:00
|
|
|
// RegisterCommand registers a custom slash command. When the command is triggered, your plugin
|
|
|
|
|
// can fulfill it via the ExecuteCommand hook.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Command
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-12-08 13:55:41 -06:00
|
|
|
RegisterCommand(command *model.Command) error
|
|
|
|
|
|
|
|
|
|
// UnregisterCommand unregisters a command previously registered via RegisterCommand.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Command
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-12-08 13:55:41 -06:00
|
|
|
UnregisterCommand(teamId, trigger string) error
|
|
|
|
|
|
2018-08-02 00:16:04 +02:00
|
|
|
// GetSession returns the session object for the Session ID
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
|
|
|
|
// Minimum server version: 5.2
|
2018-08-02 00:16:04 +02:00
|
|
|
GetSession(sessionId string) (*model.Session, *model.AppError)
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// GetConfig fetches the currently persisted config
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Configuration
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
GetConfig() *model.Config
|
|
|
|
|
|
2019-09-03 18:41:52 -04:00
|
|
|
// GetUnsanitizedConfig fetches the currently persisted config without removing secrets.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Configuration
|
2019-09-03 18:41:52 -04:00
|
|
|
// Minimum server version: 5.16
|
|
|
|
|
GetUnsanitizedConfig() *model.Config
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// SaveConfig sets the given config and persists the changes
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Configuration
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
SaveConfig(config *model.Config) *model.AppError
|
|
|
|
|
|
2018-11-19 22:57:15 +05:30
|
|
|
// GetPluginConfig fetches the currently persisted config of plugin
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-19 22:57:15 +05:30
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetPluginConfig() map[string]interface{}
|
|
|
|
|
|
|
|
|
|
// SavePluginConfig sets the given config for plugin and persists the changes
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-19 22:57:15 +05:30
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
SavePluginConfig(config map[string]interface{}) *model.AppError
|
|
|
|
|
|
2019-03-18 23:01:26 +01:00
|
|
|
// GetBundlePath returns the absolute path where the plugin's bundle was unpacked.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2019-03-18 23:01:26 +01:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetBundlePath() (string, error)
|
|
|
|
|
|
|
|
|
|
// GetLicense returns the current license used by the Mattermost server. Returns nil if the
|
2019-03-13 12:31:47 -04:00
|
|
|
// the server does not have a license.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Server
|
2019-03-13 12:31:47 -04:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetLicense() *model.License
|
|
|
|
|
|
2018-09-27 18:56:47 +02:00
|
|
|
// GetServerVersion return the current Mattermost server version
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Server
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.4
|
2018-09-27 18:56:47 +02:00
|
|
|
GetServerVersion() string
|
|
|
|
|
|
2019-03-13 12:31:47 -04:00
|
|
|
// GetSystemInstallDate returns the time that Mattermost was first installed and ran.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Server
|
2019-03-13 12:31:47 -04:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetSystemInstallDate() (int64, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetDiagnosticId returns a unique identifier used by the server for diagnostic reports.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Server
|
2019-03-13 12:31:47 -04:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetDiagnosticId() string
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// CreateUser creates a user.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
CreateUser(user *model.User) (*model.User, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// DeleteUser deletes a user.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
DeleteUser(userId string) *model.AppError
|
|
|
|
|
|
2019-01-30 18:55:02 +01:00
|
|
|
// GetUsers a list of users based on search options.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-01-30 18:55:02 +01:00
|
|
|
// Minimum server version: 5.10
|
2019-03-15 14:55:46 -04:00
|
|
|
GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)
|
2019-01-30 18:55:02 +01:00
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// GetUser gets a user.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetUser(userId string) (*model.User, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetUserByEmail gets a user by their email address.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetUserByEmail(email string) (*model.User, *model.AppError)
|
2017-08-28 14:19:00 -05:00
|
|
|
|
|
|
|
|
// GetUserByUsername gets a user by their username.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-08-28 14:19:00 -05:00
|
|
|
GetUserByUsername(name string) (*model.User, *model.AppError)
|
|
|
|
|
|
2018-10-18 15:11:30 +02:00
|
|
|
// GetUsersByUsernames gets users by their usernames.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-10-18 15:11:30 +02:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetUsersByUsernames(usernames []string) ([]*model.User, *model.AppError)
|
|
|
|
|
|
2018-10-15 18:24:26 +02:00
|
|
|
// GetUsersInTeam gets users in team.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
|
|
|
|
// @tag Team
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-15 18:24:26 +02:00
|
|
|
GetUsersInTeam(teamId string, page int, perPage int) ([]*model.User, *model.AppError)
|
2018-11-16 14:17:42 +01:00
|
|
|
|
2018-11-20 15:43:42 +01:00
|
|
|
// GetTeamIcon gets the team icon.
|
2018-11-16 14:17:42 +01:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2018-11-16 14:17:42 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetTeamIcon(teamId string) ([]byte, *model.AppError)
|
2018-10-15 18:24:26 +02:00
|
|
|
|
2018-11-20 15:43:42 +01:00
|
|
|
// SetTeamIcon sets the team icon.
|
2018-11-16 16:52:07 +01:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2018-11-16 16:52:07 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
SetTeamIcon(teamId string, data []byte) *model.AppError
|
|
|
|
|
|
2018-11-20 15:43:42 +01:00
|
|
|
// RemoveTeamIcon removes the team icon.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2018-11-20 15:43:42 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
RemoveTeamIcon(teamId string) *model.AppError
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// UpdateUser updates a user.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
UpdateUser(user *model.User) (*model.User, *model.AppError)
|
|
|
|
|
|
2018-07-16 15:49:26 -04:00
|
|
|
// GetUserStatus will get a user's status.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-16 15:49:26 -04:00
|
|
|
GetUserStatus(userId string) (*model.Status, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetUserStatusesByIds will return a list of user statuses based on the provided slice of user IDs.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-16 15:49:26 -04:00
|
|
|
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".
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-16 15:49:26 -04:00
|
|
|
UpdateUserStatus(userId, status string) (*model.Status, *model.AppError)
|
|
|
|
|
|
2018-12-12 09:18:41 -06:00
|
|
|
// UpdateUserActive deactivates or reactivates an user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-12-12 09:18:41 -06:00
|
|
|
// Minimum server version: 5.8
|
|
|
|
|
UpdateUserActive(userId string, active bool) *model.AppError
|
|
|
|
|
|
2018-10-22 08:49:50 -04:00
|
|
|
// GetUsersInChannel returns a page of users in a channel. Page counting starts at 0.
|
|
|
|
|
// The sortBy parameter can be: "username" or "status".
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
|
|
|
|
// @tag Channel
|
2018-10-22 08:49:50 -04:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetUsersInChannel(channelId, sortBy string, page, perPage int) ([]*model.User, *model.AppError)
|
|
|
|
|
|
2018-08-29 14:07:27 -04:00
|
|
|
// 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.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-29 14:07:27 -04:00
|
|
|
GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError)
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// CreateTeam creates a team.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
CreateTeam(team *model.Team) (*model.Team, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// DeleteTeam deletes a team.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
DeleteTeam(teamId string) *model.AppError
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// GetTeam gets all teams.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
GetTeams() ([]*model.Team, *model.AppError)
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// GetTeam gets a team.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetTeam(teamId string) (*model.Team, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetTeamByName gets a team by its name.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetTeamByName(name string) (*model.Team, *model.AppError)
|
|
|
|
|
|
2018-11-07 20:23:02 +01:00
|
|
|
// GetTeamsUnreadForUser gets the unread message and mention counts for each team to which the given user belongs.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2018-11-07 20:23:02 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError)
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// UpdateTeam updates a team.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
UpdateTeam(team *model.Team) (*model.Team, *model.AppError)
|
|
|
|
|
|
2019-01-16 15:13:15 +07:00
|
|
|
// SearchTeams search a team.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-01-16 15:13:15 +07:00
|
|
|
// Minimum server version: 5.8
|
|
|
|
|
SearchTeams(term string) ([]*model.Team, *model.AppError)
|
|
|
|
|
|
2018-10-17 16:37:52 +02:00
|
|
|
// GetTeamsForUser returns list of teams of given user ID.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2018-10-17 16:37:52 +02:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// CreateTeamMember creates a team membership.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
CreateTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
|
|
|
|
|
|
2019-11-06 07:49:28 +01:00
|
|
|
// CreateTeamMembers creates a team membership for all provided user ids.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
CreateTeamMembers(teamId string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)
|
|
|
|
|
|
2020-01-14 15:29:50 +02:00
|
|
|
// CreateTeamMembersGracefully creates a team membership for all provided user ids and reports the users that were not added.
|
|
|
|
|
//
|
|
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
|
|
|
|
// Minimum server version: 5.20
|
|
|
|
|
CreateTeamMembersGracefully(teamId string, userIds []string, requestorId string) ([]*model.TeamMemberWithError, *model.AppError)
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// DeleteTeamMember deletes a team membership.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
DeleteTeamMember(teamId, userId, requestorId string) *model.AppError
|
|
|
|
|
|
|
|
|
|
// GetTeamMembers returns the memberships of a specific team.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-11-19 14:43:49 +01:00
|
|
|
GetTeamMembers(teamId string, page, perPage int) ([]*model.TeamMember, *model.AppError)
|
2018-07-07 00:32:55 +02:00
|
|
|
|
|
|
|
|
// GetTeamMember returns a specific membership.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
|
|
|
|
|
|
2019-02-23 11:41:19 -08:00
|
|
|
// GetTeamMembersForUser returns all team memberships for a user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-02-23 11:41:19 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetTeamMembersForUser(userId string, page int, perPage int) ([]*model.TeamMember, *model.AppError)
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// UpdateTeamMemberRoles updates the role for a team membership.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
UpdateTeamMemberRoles(teamId, userId, newRoles string) (*model.TeamMember, *model.AppError)
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// CreateChannel creates a channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// DeleteChannel deletes a channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
DeleteChannel(channelId string) *model.AppError
|
|
|
|
|
|
2018-07-20 12:03:08 -04:00
|
|
|
// GetPublicChannelsForTeam gets a list of all channels.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-11-19 14:43:49 +01:00
|
|
|
GetPublicChannelsForTeam(teamId string, page, perPage int) ([]*model.Channel, *model.AppError)
|
2018-07-07 00:32:55 +02:00
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// GetChannel gets a channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetChannel(channelId string) (*model.Channel, *model.AppError)
|
|
|
|
|
|
2018-07-20 12:03:08 -04:00
|
|
|
// GetChannelByName gets a channel by its name, given a team id.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-30 15:06:08 -04:00
|
|
|
GetChannelByName(teamId, name string, includeDeleted bool) (*model.Channel, *model.AppError)
|
2018-07-20 12:03:08 -04:00
|
|
|
|
|
|
|
|
// GetChannelByNameForTeamName gets a channel by its name, given a team name.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag Team
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-30 15:06:08 -04:00
|
|
|
GetChannelByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)
|
2017-08-28 14:19:00 -05:00
|
|
|
|
2018-10-15 18:27:45 +02:00
|
|
|
// GetChannelsForTeamForUser gets a list of channels for given user ID in given team ID.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag Team
|
|
|
|
|
// @tag User
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-11-20 14:50:34 +01:00
|
|
|
GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError)
|
2018-10-15 18:27:45 +02:00
|
|
|
|
2018-10-25 17:24:43 +00:00
|
|
|
// GetChannelStats gets statistics for a channel.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2018-10-25 17:24:43 +00:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError)
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// GetDirectChannel gets a direct message channel.
|
2018-11-28 18:01:49 +01:00
|
|
|
// If the channel does not exist it will create it.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetGroupChannel gets a group message channel.
|
2018-11-28 18:01:49 +01:00
|
|
|
// If the channel does not exist it will create it.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// UpdateChannel updates a channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
|
|
|
|
|
|
2018-10-15 12:23:46 -04:00
|
|
|
// SearchChannels returns the channels on a team matching the provided search term.
|
2018-10-17 23:43:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
2018-10-17 23:43:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-11-20 14:50:34 +01:00
|
|
|
SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError)
|
2018-10-15 12:23:46 -04:00
|
|
|
|
2018-11-30 21:17:17 +05:30
|
|
|
// SearchUsers returns a list of users based on some search criteria.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-11-30 21:17:17 +05:30
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
SearchUsers(search *model.UserSearch) ([]*model.User, *model.AppError)
|
|
|
|
|
|
2019-02-12 22:41:32 -08:00
|
|
|
// SearchPostsInTeam returns a list of posts in a specific team that match the given params.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
|
|
|
|
// @tag Team
|
2019-02-12 22:41:32 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)
|
|
|
|
|
|
2019-10-17 16:11:26 -07:00
|
|
|
// AddChannelMember joins a user to a channel (as if they joined themselves)
|
|
|
|
|
// This means the user will not receive notifications for joining the channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-04-06 17:08:57 -04:00
|
|
|
AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)
|
|
|
|
|
|
2019-10-17 16:11:26 -07:00
|
|
|
// AddUserToChannel adds a user to a channel as if the specified user had invited them.
|
|
|
|
|
// This means the user will receive the regular notifications for being added to the channel.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
|
|
|
|
// @tag Channel
|
2019-10-17 16:11:26 -07:00
|
|
|
// Minimum server version: 5.18
|
|
|
|
|
AddUserToChannel(channelId, userId, asUserId string) (*model.ChannelMember, *model.AppError)
|
|
|
|
|
|
2017-12-05 09:14:03 -05:00
|
|
|
// GetChannelMember gets a channel membership for a user.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-12-05 09:14:03 -05:00
|
|
|
GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)
|
|
|
|
|
|
2018-10-04 01:37:54 +05:30
|
|
|
// GetChannelMembers gets a channel membership for all users.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-04 01:37:54 +05:30
|
|
|
GetChannelMembers(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)
|
|
|
|
|
|
2018-10-31 18:59:20 +05:30
|
|
|
// GetChannelMembersByIds gets a channel membership for a particular User
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2018-10-31 18:59:20 +05:30
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetChannelMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, *model.AppError)
|
|
|
|
|
|
2019-02-23 11:41:19 -08:00
|
|
|
// GetChannelMembersForUser returns all channel memberships on a team for a user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-02-23 11:41:19 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetChannelMembersForUser(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)
|
|
|
|
|
|
2018-04-06 17:08:57 -04:00
|
|
|
// UpdateChannelMemberRoles updates a user's roles for a channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-04-06 17:08:57 -04:00
|
|
|
UpdateChannelMemberRoles(channelId, userId, newRoles string) (*model.ChannelMember, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// UpdateChannelMemberNotifications updates a user's notification properties for a channel.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-04-06 17:08:57 -04:00
|
|
|
UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError)
|
|
|
|
|
|
2019-10-22 14:38:08 -04:00
|
|
|
// GetGroup gets a group by ID.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Group
|
2019-10-22 14:38:08 -04:00
|
|
|
// Minimum server version: 5.18
|
|
|
|
|
GetGroup(groupId string) (*model.Group, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetGroupByName gets a group by name.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Group
|
2019-10-22 14:38:08 -04:00
|
|
|
// Minimum server version: 5.18
|
|
|
|
|
GetGroupByName(name string) (*model.Group, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetGroupsForUser gets the groups a user is in.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Group
|
|
|
|
|
// @tag User
|
2019-10-22 14:38:08 -04:00
|
|
|
// Minimum server version: 5.18
|
|
|
|
|
GetGroupsForUser(userId string) ([]*model.Group, *model.AppError)
|
|
|
|
|
|
2018-04-06 17:08:57 -04:00
|
|
|
// DeleteChannelMember deletes a channel membership for a user.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Channel
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-04-06 17:08:57 -04:00
|
|
|
DeleteChannelMember(channelId, userId string) *model.AppError
|
|
|
|
|
|
2017-08-28 14:19:00 -05:00
|
|
|
// CreatePost creates a post.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-08-28 14:19:00 -05:00
|
|
|
CreatePost(post *model.Post) (*model.Post, *model.AppError)
|
2017-09-21 14:00:14 -05:00
|
|
|
|
2018-08-20 18:22:08 +02:00
|
|
|
// AddReaction add a reaction to a post.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 18:22:08 +02:00
|
|
|
AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// RemoveReaction remove a reaction from a post.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 18:22:08 +02:00
|
|
|
RemoveReaction(reaction *model.Reaction) *model.AppError
|
|
|
|
|
|
|
|
|
|
// GetReaction get the reactions of a post.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 18:22:08 +02:00
|
|
|
GetReactions(postId string) ([]*model.Reaction, *model.AppError)
|
|
|
|
|
|
2018-07-07 00:32:55 +02:00
|
|
|
// SendEphemeralPost creates an ephemeral post.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-07 00:32:55 +02:00
|
|
|
SendEphemeralPost(userId string, post *model.Post) *model.Post
|
|
|
|
|
|
MM-10516: Added support for PostActions in ephemeral posts (#10258)
* Added support for PostActions in ephemeral posts
The general approach is that we take all the metadata that DoPostAction
needs to process client DoPostActionRequests, and store it in a
serialized, encrypted Cookie field, in the PostAction struct.
The client then must send it back, and it is then used to process
PostActions as a fallback top the metadata in the database.
This PR adds a new config setting, `ServiceSettings.ActionCookieSecret`.
In a cluster environment it must be the same for all instances.
- Added type PostActionCookie, and a Cookie string to PostAction.
- Added App.AddActionCookiesToPost.
- Use App.AddActionCookiesToPost in api4.createEphemeralPost,
App.SendEphemeralPost, App.UpdateEphemeralPost.
- Added App.DoPostActionWithCookie to process incoming requests with
cookies. For backward compatibility, it prefers the metadata in the
database; falls back to cookie.
- Added plugin.API.UpdateEphemeralPost and plugin.API.DeleteEphemeralPost.
- Added App.encryptActionCookie/App.decryptActionCookie.
* Style
* Fixed an unfortunate typo, tested with matterpoll
* minor PR feedback
* Fixed uninitialized Context
* Fixed another test failure
* Fixed permission check
* Added api test for DoPostActionWithCookie
* Replaced config.ActionCookieSecret with Server.PostActionCookieSecret
Modeled after AsymetricSigningKey
* style
* Set DeleteAt in DeleteEphemeralPost
* PR feedback
* Removed deadwood comment
* Added EXPERIMENTAL comment to the 2 APIs in question
2019-03-01 10:15:31 -08:00
|
|
|
// UpdateEphemeralPost updates an ephemeral message previously sent to the user.
|
|
|
|
|
// EXPERIMENTAL: This API is experimental and can be changed without advance notice.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
MM-10516: Added support for PostActions in ephemeral posts (#10258)
* Added support for PostActions in ephemeral posts
The general approach is that we take all the metadata that DoPostAction
needs to process client DoPostActionRequests, and store it in a
serialized, encrypted Cookie field, in the PostAction struct.
The client then must send it back, and it is then used to process
PostActions as a fallback top the metadata in the database.
This PR adds a new config setting, `ServiceSettings.ActionCookieSecret`.
In a cluster environment it must be the same for all instances.
- Added type PostActionCookie, and a Cookie string to PostAction.
- Added App.AddActionCookiesToPost.
- Use App.AddActionCookiesToPost in api4.createEphemeralPost,
App.SendEphemeralPost, App.UpdateEphemeralPost.
- Added App.DoPostActionWithCookie to process incoming requests with
cookies. For backward compatibility, it prefers the metadata in the
database; falls back to cookie.
- Added plugin.API.UpdateEphemeralPost and plugin.API.DeleteEphemeralPost.
- Added App.encryptActionCookie/App.decryptActionCookie.
* Style
* Fixed an unfortunate typo, tested with matterpoll
* minor PR feedback
* Fixed uninitialized Context
* Fixed another test failure
* Fixed permission check
* Added api test for DoPostActionWithCookie
* Replaced config.ActionCookieSecret with Server.PostActionCookieSecret
Modeled after AsymetricSigningKey
* style
* Set DeleteAt in DeleteEphemeralPost
* PR feedback
* Removed deadwood comment
* Added EXPERIMENTAL comment to the 2 APIs in question
2019-03-01 10:15:31 -08:00
|
|
|
UpdateEphemeralPost(userId string, post *model.Post) *model.Post
|
|
|
|
|
|
|
|
|
|
// DeleteEphemeralPost deletes an ephemeral message previously sent to the user.
|
|
|
|
|
// EXPERIMENTAL: This API is experimental and can be changed without advance notice.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2019-05-16 03:32:13 -07:00
|
|
|
DeleteEphemeralPost(userId, postId string)
|
MM-10516: Added support for PostActions in ephemeral posts (#10258)
* Added support for PostActions in ephemeral posts
The general approach is that we take all the metadata that DoPostAction
needs to process client DoPostActionRequests, and store it in a
serialized, encrypted Cookie field, in the PostAction struct.
The client then must send it back, and it is then used to process
PostActions as a fallback top the metadata in the database.
This PR adds a new config setting, `ServiceSettings.ActionCookieSecret`.
In a cluster environment it must be the same for all instances.
- Added type PostActionCookie, and a Cookie string to PostAction.
- Added App.AddActionCookiesToPost.
- Use App.AddActionCookiesToPost in api4.createEphemeralPost,
App.SendEphemeralPost, App.UpdateEphemeralPost.
- Added App.DoPostActionWithCookie to process incoming requests with
cookies. For backward compatibility, it prefers the metadata in the
database; falls back to cookie.
- Added plugin.API.UpdateEphemeralPost and plugin.API.DeleteEphemeralPost.
- Added App.encryptActionCookie/App.decryptActionCookie.
* Style
* Fixed an unfortunate typo, tested with matterpoll
* minor PR feedback
* Fixed uninitialized Context
* Fixed another test failure
* Fixed permission check
* Added api test for DoPostActionWithCookie
* Replaced config.ActionCookieSecret with Server.PostActionCookieSecret
Modeled after AsymetricSigningKey
* style
* Set DeleteAt in DeleteEphemeralPost
* PR feedback
* Removed deadwood comment
* Added EXPERIMENTAL comment to the 2 APIs in question
2019-03-01 10:15:31 -08:00
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// DeletePost deletes a post.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
DeletePost(postId string) *model.AppError
|
|
|
|
|
|
2018-10-15 15:19:36 +02:00
|
|
|
// GetPostThread gets a post with all the other posts in the same thread.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-15 15:19:36 +02:00
|
|
|
GetPostThread(postId string) (*model.PostList, *model.AppError)
|
|
|
|
|
|
2017-09-21 14:00:14 -05:00
|
|
|
// GetPost gets a post.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
GetPost(postId string) (*model.Post, *model.AppError)
|
|
|
|
|
|
2018-10-15 16:04:22 +02:00
|
|
|
// GetPostsSince gets posts created after a specified time as Unix time in milliseconds.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
|
|
|
|
// @tag Channel
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-15 16:04:22 +02:00
|
|
|
GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)
|
|
|
|
|
|
2018-10-18 18:11:15 +02:00
|
|
|
// GetPostsAfter gets a page of posts that were posted after the post provided.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
|
|
|
|
// @tag Channel
|
2018-10-18 18:11:15 +02:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)
|
|
|
|
|
|
2018-10-15 19:18:23 +02:00
|
|
|
// GetPostsBefore gets a page of posts that were posted before the post provided.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
|
|
|
|
// @tag Channel
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-15 19:18:23 +02:00
|
|
|
GetPostsBefore(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)
|
|
|
|
|
|
2018-10-10 18:53:36 +05:30
|
|
|
// GetPostsForChannel gets a list of posts for a channel.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
|
|
|
|
// @tag Channel
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-10 18:53:36 +05:30
|
|
|
GetPostsForChannel(channelId string, page, perPage int) (*model.PostList, *model.AppError)
|
|
|
|
|
|
2019-01-15 14:52:04 +05:30
|
|
|
// GetTeamStats gets a team's statistics
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Team
|
2019-01-15 14:52:04 +05:30
|
|
|
// Minimum server version: 5.8
|
|
|
|
|
GetTeamStats(teamId string) (*model.TeamStats, *model.AppError)
|
|
|
|
|
|
2017-11-27 17:23:35 -05:00
|
|
|
// UpdatePost updates a post.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Post
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2017-09-21 14:00:14 -05:00
|
|
|
UpdatePost(post *model.Post) (*model.Post, *model.AppError)
|
2017-11-27 17:23:35 -05:00
|
|
|
|
2018-10-17 16:16:15 +02:00
|
|
|
// GetProfileImage gets user's profile image.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-15 16:23:41 +02:00
|
|
|
GetProfileImage(userId string) ([]byte, *model.AppError)
|
|
|
|
|
|
2018-11-15 21:23:03 +01:00
|
|
|
// SetProfileImage sets a user's profile image.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-11-15 21:23:03 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
SetProfileImage(userId string, data []byte) *model.AppError
|
|
|
|
|
|
2018-11-05 19:20:08 +05:30
|
|
|
// GetEmojiList returns a page of custom emoji on the system.
|
|
|
|
|
//
|
|
|
|
|
// The sortBy parameter can be: "name".
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Emoji
|
2018-11-05 19:20:08 +05:30
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError)
|
|
|
|
|
|
2018-10-15 17:09:30 -04:00
|
|
|
// GetEmojiByName gets an emoji by it's name.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Emoji
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-15 17:09:30 -04:00
|
|
|
GetEmojiByName(name string) (*model.Emoji, *model.AppError)
|
|
|
|
|
|
2018-10-25 13:54:10 +00:00
|
|
|
// GetEmoji returns a custom emoji based on the emojiId string.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Emoji
|
2018-10-25 13:54:10 +00:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetEmoji(emojiId string) (*model.Emoji, *model.AppError)
|
|
|
|
|
|
2018-08-10 11:21:37 -04:00
|
|
|
// 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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag File
|
|
|
|
|
// @tag User
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-08-02 10:37:31 -04:00
|
|
|
CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)
|
|
|
|
|
|
2018-08-20 13:18:25 -03:00
|
|
|
// GetFileInfo gets a File Info for a specific fileId
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag File
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 13:18:25 -03:00
|
|
|
GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)
|
|
|
|
|
|
2018-12-13 15:16:42 +05:30
|
|
|
// GetFile gets content of a file by it's ID
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag File
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.8
|
2018-12-13 15:16:42 +05:30
|
|
|
GetFile(fileId string) ([]byte, *model.AppError)
|
|
|
|
|
|
2018-10-17 20:31:51 -04:00
|
|
|
// GetFileLink gets the public link to a file by fileId.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag File
|
2018-10-17 20:31:51 -04:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetFileLink(fileId string) (string, *model.AppError)
|
|
|
|
|
|
2019-11-15 04:19:00 +00:00
|
|
|
// ReadFile reads the file from the backend for a specific path
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag File
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 13:18:25 -03:00
|
|
|
ReadFile(path string) ([]byte, *model.AppError)
|
|
|
|
|
|
2018-10-19 04:07:21 +08:00
|
|
|
// GetEmojiImage returns the emoji image.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Emoji
|
2018-10-19 04:07:21 +08:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)
|
|
|
|
|
|
2018-11-07 21:24:54 +01:00
|
|
|
// UploadFile will upload a file to a channel using a multipart request, to be later attached to a post.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag File
|
|
|
|
|
// @tag Channel
|
2018-11-07 21:24:54 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
|
|
|
|
|
|
2018-11-19 15:27:17 -05:00
|
|
|
// OpenInteractiveDialog will open an interactive dialog on a user's client that
|
|
|
|
|
// generated the trigger ID. Used with interactive message buttons, menus
|
|
|
|
|
// and slash commands.
|
|
|
|
|
//
|
|
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError
|
|
|
|
|
|
2018-11-08 19:17:07 +01:00
|
|
|
// Plugin Section
|
|
|
|
|
|
|
|
|
|
// GetPlugins will return a list of plugin manifests for currently active plugins.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-08 19:17:07 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetPlugins() ([]*model.Manifest, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// EnablePlugin will enable an plugin installed.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-08 19:17:07 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
EnablePlugin(id string) *model.AppError
|
|
|
|
|
|
|
|
|
|
// DisablePlugin will disable an enabled plugin.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-08 19:17:07 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
DisablePlugin(id string) *model.AppError
|
|
|
|
|
|
|
|
|
|
// RemovePlugin will disable and delete a plugin.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-08 19:17:07 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
RemovePlugin(id string) *model.AppError
|
|
|
|
|
|
|
|
|
|
// GetPluginStatus will return the status of a plugin.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2018-11-08 19:17:07 +01:00
|
|
|
// Minimum server version: 5.6
|
|
|
|
|
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
|
|
|
|
|
2019-10-17 20:57:55 +02:00
|
|
|
// InstallPlugin will upload another plugin with tar.gz file.
|
|
|
|
|
// Previous version will be replaced on replace true.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Plugin
|
2019-10-17 20:57:55 +02:00
|
|
|
// Minimum server version: 5.18
|
|
|
|
|
InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)
|
|
|
|
|
|
2018-11-08 19:17:07 +01:00
|
|
|
// KV Store Section
|
|
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVSet stores a key-value pair, unique per plugin.
|
2019-05-06 12:44:38 -07:00
|
|
|
// Provided helper functions and internal plugin code will use the prefix `mmi_` before keys. Do not use this prefix.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-06-25 12:33:13 -07:00
|
|
|
KVSet(key string, value []byte) *model.AppError
|
2017-11-27 17:23:35 -05:00
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVCompareAndSet updates a key-value pair, unique per plugin, but only if the current value matches the given oldValue.
|
2019-04-23 13:35:17 -04:00
|
|
|
// Inserts a new key if oldValue == nil.
|
|
|
|
|
// Returns (false, err) if DB error occurred
|
2019-07-05 17:33:39 -03:00
|
|
|
// Returns (false, nil) if current value != oldValue or key already exists when inserting
|
|
|
|
|
// Returns (true, nil) if current value == oldValue or new key is inserted
|
2019-04-23 13:35:17 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2019-04-23 13:35:17 -04:00
|
|
|
// Minimum server version: 5.12
|
|
|
|
|
KVCompareAndSet(key string, oldValue, newValue []byte) (bool, *model.AppError)
|
|
|
|
|
|
2019-08-21 23:25:38 -03:00
|
|
|
// KVCompareAndDelete deletes a key-value pair, unique per plugin, but only if the current value matches the given oldValue.
|
|
|
|
|
// Returns (false, err) if DB error occurred
|
|
|
|
|
// Returns (false, nil) if current value != oldValue or key does not exist when deleting
|
|
|
|
|
// Returns (true, nil) if current value == oldValue and the key was deleted
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2019-08-21 23:25:38 -03:00
|
|
|
// Minimum server version: 5.16
|
|
|
|
|
KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError)
|
|
|
|
|
|
2019-11-04 09:49:54 -03:00
|
|
|
// KVSetWithOptions stores a key-value pair, unique per plugin, according to the given options.
|
|
|
|
|
// Returns (false, err) if DB error occurred
|
|
|
|
|
// Returns (false, nil) if the value was not set
|
|
|
|
|
// Returns (true, nil) if the value was set
|
|
|
|
|
//
|
2019-12-03 10:46:15 +01:00
|
|
|
// Minimum server version: 5.20
|
|
|
|
|
KVSetWithOptions(key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
|
2019-11-04 09:49:54 -03:00
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVSet stores a key-value pair with an expiry time, unique per plugin.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-10 19:55:12 +02:00
|
|
|
KVSetWithExpiry(key string, value []byte, expireInSeconds int64) *model.AppError
|
|
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVGet retrieves a value based on the key, unique per plugin. Returns nil for non-existent keys.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-06-25 12:33:13 -07:00
|
|
|
KVGet(key string) ([]byte, *model.AppError)
|
2017-11-27 17:23:35 -05:00
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVDelete removes a key-value pair, unique per plugin. Returns nil for non-existent keys.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-06-25 12:33:13 -07:00
|
|
|
KVDelete(key string) *model.AppError
|
2018-06-27 08:46:38 -04:00
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVDeleteAll removes all key-value pairs for a plugin.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-10 19:55:12 +02:00
|
|
|
KVDeleteAll() *model.AppError
|
|
|
|
|
|
2019-07-05 17:33:39 -03:00
|
|
|
// KVList lists all keys for a plugin.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag KeyValueStore
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.6
|
2018-10-03 13:04:37 -07:00
|
|
|
KVList(page, perPage int) ([]string, *model.AppError)
|
|
|
|
|
|
2018-06-27 08:46:38 -04:00
|
|
|
// PublishWebSocketEvent sends an event to WebSocket connections.
|
2019-01-10 03:29:26 +09:00
|
|
|
// 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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
|
|
|
|
// Minimum server version: 5.2
|
2018-06-27 08:46:38 -04:00
|
|
|
PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
|
2018-07-03 09:58:28 -07:00
|
|
|
|
2018-08-20 18:22:08 +02:00
|
|
|
// HasPermissionTo check if the user has the permission at system scope.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 18:22:08 +02:00
|
|
|
HasPermissionTo(userId string, permission *model.Permission) bool
|
|
|
|
|
|
|
|
|
|
// HasPermissionToTeam check if the user has the permission at team scope.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
|
|
|
|
// @tag Team
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 18:22:08 +02:00
|
|
|
HasPermissionToTeam(userId, teamId string, permission *model.Permission) bool
|
|
|
|
|
|
|
|
|
|
// HasPermissionToChannel check if the user has the permission at channel scope.
|
2018-10-17 16:16:15 +02:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag User
|
|
|
|
|
// @tag Channel
|
2018-10-17 16:16:15 +02:00
|
|
|
// Minimum server version: 5.3
|
2018-08-20 18:22:08 +02:00
|
|
|
HasPermissionToChannel(userId, channelId string, permission *model.Permission) bool
|
|
|
|
|
|
2018-07-03 09:58:28 -07:00
|
|
|
// 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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Logging
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-03 09:58:28 -07:00
|
|
|
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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Logging
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-03 09:58:28 -07:00
|
|
|
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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Logging
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-03 09:58:28 -07:00
|
|
|
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.
|
2019-09-17 02:03:28 -04:00
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Logging
|
2019-09-17 02:03:28 -04:00
|
|
|
// Minimum server version: 5.2
|
2018-07-03 09:58:28 -07:00
|
|
|
LogWarn(msg string, keyValuePairs ...interface{})
|
2019-01-10 10:06:14 +01:00
|
|
|
|
|
|
|
|
// SendMail sends an email to a specific address
|
|
|
|
|
//
|
|
|
|
|
// Minimum server version: 5.7
|
|
|
|
|
SendMail(to, subject, htmlBody string) *model.AppError
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
|
|
|
|
|
// CreateBot creates the given bot and corresponding user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// PatchBot applies the given patch to the bot and corresponding user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetBot returns the given bot.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// GetBots returns the requested page of bots.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
GetBots(options *model.BotGetOptions) ([]*model.Bot, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// PermanentDeleteBot permanently deletes a bot and its corresponding user.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)
* bots model, store and api
Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119
* uncomment tests incorrectly commented, and fix merge issues
* add etags support
* add missing licenses
* remove unused sqlbuilder.go (for now...)
* rejig permissions
* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS
* conform to general rest api pattern
* eliminate redundant http.StatusOK
* Update api4/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* s/model.UserFromBotModel/model.UserFromBot/g
* Update model/bot.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* Update model/client4.go
Co-Authored-By: lieut-data <jesse.hallam@gmail.com>
* move sessionHasPermissionToManageBot to app/authorization.go
* use api.ApiSessionRequired for createBot
* introduce BOT_DESCRIPTION_MAX_RUNES constant
* MM-13512 Prevent getting a user by email based on privacy settings (#10021)
* MM-13512 Prevent getting a user by email based on privacy settings
* Add additional config settings to tests
* upgrade db to 5.7 (#10019)
* MM-13526 Add validation when setting a user's Locale field (#10022)
* Fix typos (#10024)
* Fixing first user being created with system admin privilages without being explicity specified. (#10014)
* Revert "Support for Embeded chat (#9129)" (#10017)
This reverts commit 3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.
* s/DisableBot/UpdateBotActive
* add permissions on upgrade
* Update NOTICE.txt (#10054)
- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates
* avoid leaking bot knowledge without permission
* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)
* 6798 added a new api to get the bulk reactions for posts
* 6798 added the permsission check before getting the reactions
* GH-6798 added a new app function for the new endpoint
* 6798 added a store method to get reactions for multiple posts
* 6798 connected the app function with the new store function
* 6798 fixed the review comments
* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)
Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023
* Trigger Login Hooks with OAuth (#10061)
* make BotStore.GetAll deterministic even on duplicate CreateAt
* fix spurious TestMuteCommandSpecificChannel test failure
See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw
* fix race in TestExportUserChannels
* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
* MM-13117: bot tokens (#10111)
* eliminate redundant Client/AdminClient declarations
* harden TestUpdateChannelScheme to API failures
* eliminate unnecessary config restoration
* minor cleanup
* make TestGenerateMfaSecret config dependency explicit
* TestCreateUserAccessToken for bots
* TestGetUserAccessToken* for bots
* leverage SessionHasPermissionToUserOrBot for user token APIs
* Test(Revoke|Disable|Enable)UserAccessToken
* make EnableUserAccessTokens explicit, so as to not rely on local config.json
* uncomment TestResetPassword, but still skip
* mark assert(Invalid)Token as helper
* fix whitespace issues
* fix mangled comments
* MM-13116: bot plugin api (#10113)
* MM-13117: expose bot API to plugins
This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.
* gofmt issues
* expunge use of BotList in plugin/client API
* introduce model.BotGetOptions
* use botUserId term for clarity
* MM-13129 Adding functionality to deal with orphaned bots (#10238)
* Add way to list orphaned bots.
* Add /assign route to modify ownership of bot accounts.
* Apply suggestions from code review
Co-Authored-By: crspeller <crspeller@gmail.com>
* MM-13120: add IsBot field to returned user objects (#10103)
* MM-13104: forbid bot login (#10251)
* MM-13104: disallow bot login
* fix shadowing
* MM-13136 Disable user bots when user is disabled. (#10293)
* Disable user bots when user is disabled.
* Grammer.
Co-Authored-By: crspeller <crspeller@gmail.com>
* Fixing bot branch for test changes.
* Don't use external dependancies in bot plugin tests.
* Rename bot CreatorId to OwnerId
* Adding ability to re-enable bots
* Fixing IsBot to not attempt to be saved to DB.
* Adding diagnostics and licencing counting for bot accounts.
* Modifying gorp to allow reading of '-' fields.
* Removing unnessisary nil values from UserCountOptions.
* Changing comment to GoDoc format
* Improving user count SQL
* Some improvments from feedback.
* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
|
|
|
// Minimum server version: 5.10
|
|
|
|
|
PermanentDeleteBot(botUserId string) *model.AppError
|
2019-07-11 12:00:12 -04:00
|
|
|
|
|
|
|
|
// GetBotIconImage gets LHS bot icon image.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
2019-07-11 12:00:12 -04:00
|
|
|
// Minimum server version: 5.14
|
|
|
|
|
GetBotIconImage(botUserId string) ([]byte, *model.AppError)
|
|
|
|
|
|
|
|
|
|
// SetBotIconImage sets LHS bot icon image.
|
|
|
|
|
// Icon image must be SVG format, all other formats are rejected.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
2019-07-11 12:00:12 -04:00
|
|
|
// Minimum server version: 5.14
|
|
|
|
|
SetBotIconImage(botUserId string, data []byte) *model.AppError
|
|
|
|
|
|
|
|
|
|
// DeleteBotIconImage deletes LHS bot icon image.
|
|
|
|
|
//
|
2019-11-06 07:49:28 +01:00
|
|
|
// @tag Bot
|
2019-07-11 12:00:12 -04:00
|
|
|
// Minimum server version: 5.14
|
|
|
|
|
DeleteBotIconImage(botUserId string) *model.AppError
|
2019-11-04 17:35:58 -08:00
|
|
|
|
|
|
|
|
// PluginHTTP allows inter-plugin requests to plugin APIs.
|
|
|
|
|
//
|
|
|
|
|
// Minimum server version: 5.18
|
|
|
|
|
PluginHTTP(request *http.Request) *http.Response
|
2018-06-25 12:33:13 -07:00
|
|
|
}
|
|
|
|
|
|
2018-07-13 10:29:50 -04:00
|
|
|
var handshake = plugin.HandshakeConfig{
|
2018-06-25 12:33:13 -07:00
|
|
|
ProtocolVersion: 1,
|
|
|
|
|
MagicCookieKey: "MATTERMOST_PLUGIN",
|
|
|
|
|
MagicCookieValue: "Securely message teams, anywhere.",
|
2017-08-16 17:23:38 -05:00
|
|
|
}
|