mirror of
https://gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud
synced 2025-07-15 11:38:26 +00:00
Added User related tests
This commit is contained in:
@ -1 +1,35 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
req "github.com/levigross/grequests"
|
||||
"github.com/partitio/gonextcloud/client/types"
|
||||
)
|
||||
|
||||
func (c *Client) AppList() ([]string, error) {
|
||||
if !c.loggedIn() {
|
||||
return nil, unauthorized
|
||||
}
|
||||
u := c.baseURL.ResolveReference(routes.apps)
|
||||
res, err := c.session.Get(u.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r types.AppListResponse
|
||||
res.JSON(&r)
|
||||
return r.Ocs.Data.Apps, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *Client) appsBaseRequest(name string, route string, ro *req.RequestOptions, method string) error {
|
||||
res, err := c.baseRequest(routes.apps, name, route, ro, method)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var r types.UserResponse
|
||||
res.JSON(&r)
|
||||
if r.Ocs.Meta.Statuscode != 100 {
|
||||
e := types.ErrorFromMeta(r.Ocs.Meta)
|
||||
return &e
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user