summaryrefslogtreecommitdiffstats
path: root/plugin/api.go
diff options
context:
space:
mode:
authorDaniel Schalla <daniel@schalla.me>2018-07-07 00:32:55 +0200
committerChristopher Speller <crspeller@gmail.com>2018-07-06 15:32:55 -0700
commit359f12db33d45b6ffade0872ddf3652a5c52f4a8 (patch)
tree6c60918089574d5bbc1e5121be276d23ef41773d /plugin/api.go
parent4c1ddcff10b359baf5728b334acb60cc3e1b1123 (diff)
downloadchat-359f12db33d45b6ffade0872ddf3652a5c52f4a8.tar.gz
chat-359f12db33d45b6ffade0872ddf3652a5c52f4a8.tar.bz2
chat-359f12db33d45b6ffade0872ddf3652a5c52f4a8.zip
First batch of new plugin api methods (#9022)
update api mocks Generated new hooks ChannelHasJoinedChannel Implementation User Left Team/Channel Hook; User Joined Team Hook Implementation Update RPC Client and Mocks gofmt go tests fix Add Config API Methods codegne Add Channel Has Been Created Hook Fix ChannelHasBeenCreated hook fix missing context param fix duplicate hooks; remove redudandcy
Diffstat (limited to 'plugin/api.go')
-rw-r--r--plugin/api.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/plugin/api.go b/plugin/api.go
index 81a27c330..2b15a3d09 100644
--- a/plugin/api.go
+++ b/plugin/api.go
@@ -24,6 +24,12 @@ type API interface {
// UnregisterCommand unregisters a command previously registered via RegisterCommand.
UnregisterCommand(teamId, trigger string) error
+ // GetConfig fetches the currently persisted config
+ GetConfig() *model.Config
+
+ // SaveConfig sets the given config and persists the changes
+ SaveConfig(config *model.Config) *model.AppError
+
// CreateUser creates a user.
CreateUser(user *model.User) (*model.User, *model.AppError)
@@ -48,6 +54,9 @@ type API interface {
// DeleteTeam deletes a team.
DeleteTeam(teamId string) *model.AppError
+ // GetTeam gets all teams.
+ GetTeams() ([]*model.Team, *model.AppError)
+
// GetTeam gets a team.
GetTeam(teamId string) (*model.Team, *model.AppError)
@@ -57,12 +66,33 @@ type API interface {
// UpdateTeam updates a team.
UpdateTeam(team *model.Team) (*model.Team, *model.AppError)
+ // CreateTeamMember creates a team membership.
+ CreateTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
+
+ // CreateTeamMember creates a team membership for all provided user ids.
+ CreateTeamMembers(teamId string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)
+
+ // DeleteTeamMember deletes a team membership.
+ DeleteTeamMember(teamId, userId, requestorId string) *model.AppError
+
+ // GetTeamMembers returns the memberships of a specific team.
+ GetTeamMembers(teamId string, offset, limit int) ([]*model.TeamMember, *model.AppError)
+
+ // GetTeamMember returns a specific membership.
+ GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
+
+ // UpdateTeamMemberRoles updates the role for a team membership.
+ UpdateTeamMemberRoles(teamId, userId, newRoles string) (*model.TeamMember, *model.AppError)
+
// CreateChannel creates a channel.
CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
// DeleteChannel deletes a channel.
DeleteChannel(channelId string) *model.AppError
+ // GetChannels gets a list of all channels.
+ GetPublicChannelsForTeam(teamId string, offset, limit int) (*model.ChannelList, *model.AppError)
+
// GetChannel gets a channel.
GetChannel(channelId string) (*model.Channel, *model.AppError)
@@ -96,6 +126,9 @@ type API interface {
// CreatePost creates a post.
CreatePost(post *model.Post) (*model.Post, *model.AppError)
+ // SendEphemeralPost creates an ephemeral post.
+ SendEphemeralPost(userId string, post *model.Post) *model.Post
+
// DeletePost deletes a post.
DeletePost(postId string) *model.AppError