Added search to Groups' ListDetails

This commit is contained in:
Adphi 2019-01-31 13:23:06 +01:00
parent 3e33481fb4
commit 2d66aa5161
4 changed files with 16 additions and 11 deletions

View File

@ -543,7 +543,7 @@ func TestGroupListDetails(t *testing.T) {
if err := initClient(); err != nil { if err := initClient(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
gs, err := c.Groups().ListDetails() gs, err := c.Groups().ListDetails("")
assert.NoError(t, err) assert.NoError(t, err)
assert.NotEmpty(t, gs) assert.NotEmpty(t, gs)
} }

View File

@ -23,8 +23,13 @@ func (g *Groups) List() ([]string, error) {
} }
//ListDetails lists the Nextcloud groups //ListDetails lists the Nextcloud groups
func (g *Groups) ListDetails() ([]types.Group, error) { func (g *Groups) ListDetails(search string) ([]types.Group, error) {
res, err := g.c.baseRequest(http.MethodGet, routes.groups, nil, "details") ro := &req.RequestOptions{
Params: map[string]string{
"search": search,
},
}
res, err := g.c.baseRequest(http.MethodGet, routes.groups, ro, "details")
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -42,7 +42,7 @@ type AppsConfig interface {
//Groups available methods //Groups available methods
type Groups interface { type Groups interface {
List() ([]string, error) List() ([]string, error)
ListDetails() ([]Group, error) ListDetails(search string) ([]Group, error)
Users(name string) ([]string, error) Users(name string) ([]string, error)
Search(search string) ([]string, error) Search(search string) ([]string, error)
Create(name string) error Create(name string) error

View File

@ -61,13 +61,13 @@ func (_m *Groups) List() ([]string, error) {
return r0, r1 return r0, r1
} }
// ListDetails provides a mock function with given fields: // ListDetails provides a mock function with given fields: search
func (_m *Groups) ListDetails() ([]types.Group, error) { func (_m *Groups) ListDetails(search string) ([]types.Group, error) {
ret := _m.Called() ret := _m.Called(search)
var r0 []types.Group var r0 []types.Group
if rf, ok := ret.Get(0).(func() []types.Group); ok { if rf, ok := ret.Get(0).(func(string) []types.Group); ok {
r0 = rf() r0 = rf(search)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]types.Group) r0 = ret.Get(0).([]types.Group)
@ -75,8 +75,8 @@ func (_m *Groups) ListDetails() ([]types.Group, error) {
} }
var r1 error var r1 error
if rf, ok := ret.Get(1).(func() error); ok { if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf() r1 = rf(search)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }