GH-9636 plugins api GetUsersInChannelByStatus (#9645)

* adds GetUsersInChannelByStatus to plugin api with generated rpc code.

* fixed typo in comment with actual func name

* replaced Response model with AppError in output of GetUsersInChannelByStatus

* removed etag param from GetUsersInChannelByStatus since it is not used

* plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api.

* fixed an issue in my own logic on app/plugin integration.

* adds GetUsersInChannelByStatus to plugin api with generated rpc code.

* fixed typo in comment with actual func name

* replaced Response model with AppError in output of GetUsersInChannelByStatus

* removed etag param from GetUsersInChannelByStatus since it is not used

* plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api.

* fixed an issue in my own logic on app/plugin integration.

* GetUsersInChannelByStatus changed to more generic GetUsersInChannel which takes a sortBy parameter, allowing for more granular/extensible sorting functionality in the future

* GetUsersInChannel accepts sort parameter of 'username' and 'status'. Both values are consts in model pkg.

* Documents minimum server version for GetUsersInChannel.

* adds GetUsersInChannelByStatus to plugin api with generated rpc code.

* fixed typo in comment with actual func name

* replaced Response model with AppError in output of GetUsersInChannelByStatus

* removed etag param from GetUsersInChannelByStatus since it is not used

* plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api.

* fixed an issue in my own logic on app/plugin integration.

* adds GetUsersInChannelByStatus to plugin api with generated rpc code.

* Resolved conflict on rebase

* replaced Response model with AppError in output of GetUsersInChannelByStatus

* removed etag param from GetUsersInChannelByStatus since it is not used

* plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api.

* fixed an issue in my own logic on app/plugin integration.

* GetUsersInChannelByStatus changed to more generic GetUsersInChannel which takes a sortBy parameter, allowing for more granular/extensible sorting functionality in the future

* GetUsersInChannel accepts sort parameter of 'username' and 'status'. Both values are consts in model pkg.

* Documents minimum server version for GetUsersInChannel.

* replaces GetUsersInChannel from #9608 / #9643 with sortBy functionality
This commit is contained in:
Jason Simmons
2018-10-22 08:49:50 -04:00
committed by Joram Wilander
parent 6c6638f05e
commit 1ee872578c
6 changed files with 80 additions and 66 deletions

View File

@@ -1004,6 +1004,38 @@ func (s *apiRPCServer) UpdateUserStatus(args *Z_UpdateUserStatusArgs, returns *Z
return nil
}
type Z_GetUsersInChannelArgs struct {
A string
B string
C int
D int
}
type Z_GetUsersInChannelReturns struct {
A []*model.User
B *model.AppError
}
func (g *apiRPCClient) GetUsersInChannel(channelId, sortBy string, page, perPage int) ([]*model.User, *model.AppError) {
_args := &Z_GetUsersInChannelArgs{channelId, sortBy, page, perPage}
_returns := &Z_GetUsersInChannelReturns{}
if err := g.client.Call("Plugin.GetUsersInChannel", _args, _returns); err != nil {
log.Printf("RPC call to GetUsersInChannel API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetUsersInChannel(args *Z_GetUsersInChannelArgs, returns *Z_GetUsersInChannelReturns) error {
if hook, ok := s.impl.(interface {
GetUsersInChannel(channelId, sortBy string, page, perPage int) ([]*model.User, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetUsersInChannel(args.A, args.B, args.C, args.D)
} else {
return encodableError(fmt.Errorf("API GetUsersInChannel called but not implemented."))
}
return nil
}
type Z_GetLDAPUserAttributesArgs struct {
A string
B []string
@@ -1928,37 +1960,6 @@ func (s *apiRPCServer) DeleteChannelMember(args *Z_DeleteChannelMemberArgs, retu
return nil
}
type Z_GetUsersInChannelArgs struct {
A string
B int
C int
}
type Z_GetUsersInChannelReturns struct {
A []*model.User
B *model.AppError
}
func (g *apiRPCClient) GetUsersInChannel(channelId string, page int, perPage int) ([]*model.User, *model.AppError) {
_args := &Z_GetUsersInChannelArgs{channelId, page, perPage}
_returns := &Z_GetUsersInChannelReturns{}
if err := g.client.Call("Plugin.GetUsersInChannel", _args, _returns); err != nil {
log.Printf("RPC call to GetUsersInChannel API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetUsersInChannel(args *Z_GetUsersInChannelArgs, returns *Z_GetUsersInChannelReturns) error {
if hook, ok := s.impl.(interface {
GetUsersInChannel(channelId string, page int, perPage int) ([]*model.User, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetUsersInChannel(args.A, args.B, args.C)
} else {
return encodableError(fmt.Errorf("API GetUsersInChannel called but not implemented."))
}
return nil
}
type Z_CreatePostArgs struct {
A *model.Post
}