mirror of
https://gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud
synced 2024-11-22 10:36:24 +00:00
Removed interface, updated docs and README.md
This commit is contained in:
parent
eaf22de54b
commit
a936492816
170
README.md
170
README.md
@ -2,58 +2,28 @@
|
|||||||
|
|
||||||
A simple Client for Nextcloud's API in Go.
|
A simple Client for Nextcloud's API in Go.
|
||||||
|
|
||||||
## TODO
|
# gonextcloud
|
||||||
- [Auth](#authentication)
|
|
||||||
- ~~login~~
|
|
||||||
- ~~logout~~
|
|
||||||
- [Users](#users)
|
|
||||||
- ~~search~~
|
|
||||||
- ~~list~~
|
|
||||||
- ~~get infos~~
|
|
||||||
- ~~create~~
|
|
||||||
- ~~update~~
|
|
||||||
- ~~delete~~
|
|
||||||
- ~~enable~~
|
|
||||||
- ~~disable~~
|
|
||||||
- ~~get groups~~
|
|
||||||
- ~~add to group~~
|
|
||||||
- ~~remove from group~~
|
|
||||||
- ~~get subadmin group~~
|
|
||||||
- ~~promote subadmin~~
|
|
||||||
- ~~demote subadmin~~
|
|
||||||
- ~~send welcome mail~~
|
|
||||||
- [Groups](#groups)
|
|
||||||
- ~~create~~
|
|
||||||
- ~~delete~~
|
|
||||||
- ~~get members~~
|
|
||||||
- ~~get subadmins~~
|
|
||||||
- [Apps](#apps)
|
|
||||||
- list
|
|
||||||
- get infos
|
|
||||||
- enable
|
|
||||||
- disable
|
|
||||||
|
|
||||||
# client
|
|
||||||
--
|
|
||||||
```go
|
```go
|
||||||
import "github.com/partitio/gonextcloud/client"
|
import "github.com/partitio/gonextcloud/client"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/partitio/gonextcloud/client"
|
"github.com/partitio/gonextcloud"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
url := "https://www.mynextcloud.com"
|
url := "https://www.mynextcloud.com"
|
||||||
username := "admin"
|
username := "admin"
|
||||||
password := "password"
|
password := "password"
|
||||||
c, err := client.NewClient(url)
|
c, err := gonextcloud.NewClient(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -64,13 +34,92 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### type Client
|
||||||
|
|
||||||
|
```go
|
||||||
|
type Client struct {
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#### func NewClient
|
#### func NewClient
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewClient(hostname string) (*Client, error)
|
func NewClient(hostname string) (*Client, error)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Authentication
|
#### func (*Client) AppDisable
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppDisable(name string) error
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppEnable
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppEnable(name string) error
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppInfos
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppInfos(name string) (types.App, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppList
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppList() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppListDisabled
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppListDisabled() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppListEnabled
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppListEnabled() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) GroupCreate
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) GroupCreate(name string) error
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) GroupDelete
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) GroupDelete(name string) error
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) GroupList
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) GroupList() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) GroupSearch
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) GroupSearch(search string) ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) GroupSubAdminList
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) GroupSubAdminList(name string) ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) GroupUsers
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) GroupUsers(name string) ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
#### func (*Client) Login
|
#### func (*Client) Login
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -78,10 +127,11 @@ func (c *Client) Login(username string, password string) error
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### func (*Client) Logout
|
#### func (*Client) Logout
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) Logout() error
|
func (c *Client) Logout() error
|
||||||
```
|
```
|
||||||
## Users
|
|
||||||
#### func (*Client) User
|
#### func (*Client) User
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -91,7 +141,7 @@ func (c *Client) User(name string) (*types.User, error)
|
|||||||
#### func (*Client) UserCreate
|
#### func (*Client) UserCreate
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) UserCreate(username string, password string) error
|
func (c *Client) UserCreate(username string, password string, user *types.User) error
|
||||||
```
|
```
|
||||||
|
|
||||||
#### func (*Client) UserDelete
|
#### func (*Client) UserDelete
|
||||||
@ -166,6 +216,12 @@ func (c *Client) UserSearch(search string) ([]string, error)
|
|||||||
func (c *Client) UserSendWelcomeEmail(name string) error
|
func (c *Client) UserSendWelcomeEmail(name string) error
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### func (*Client) UserUpdate
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) UserUpdate(user *types.User) error
|
||||||
|
```
|
||||||
|
|
||||||
#### func (*Client) UserUpdateAddress
|
#### func (*Client) UserUpdateAddress
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -199,7 +255,7 @@ func (c *Client) UserUpdatePhone(name string, phone string) error
|
|||||||
#### func (*Client) UserUpdateQuota
|
#### func (*Client) UserUpdateQuota
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) UserUpdateQuota(name string, quota string) error
|
func (c *Client) UserUpdateQuota(name string, quota int) error
|
||||||
```
|
```
|
||||||
|
|
||||||
#### func (*Client) UserUpdateTwitter
|
#### func (*Client) UserUpdateTwitter
|
||||||
@ -210,43 +266,13 @@ func (c *Client) UserUpdateTwitter(name string, twitter string) error
|
|||||||
|
|
||||||
#### func (*Client) UserUpdateWebSite
|
#### func (*Client) UserUpdateWebSite
|
||||||
|
|
||||||
## Groups
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) UserUpdateWebSite(name string, website string) error
|
func (c *Client) UserUpdateWebSite(name string, website string) error
|
||||||
```
|
```
|
||||||
#### func (*Client) GroupCreate
|
|
||||||
|
#### type Routes
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) GroupCreate(name string) error
|
type Routes struct {
|
||||||
```
|
}
|
||||||
|
|
||||||
#### func (*Client) GroupDelete
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (c *Client) GroupDelete(name string) error
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*Client) GroupList
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (c *Client) GroupList() ([]string, error)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*Client) GroupSearch
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (c *Client) GroupSearch(search string) ([]string, error)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*Client) GroupSubAdminList
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (c *Client) GroupSubAdminList(name string) ([]string, error)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*Client) GroupUsers
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (c *Client) GroupUsers(name string) ([]string, error)
|
|
||||||
```
|
```
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# client
|
![Nextcloud](https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Nextcloud_Logo.svg/2000px-Nextcloud_Logo.svg.png)
|
||||||
--
|
|
||||||
|
# gonextcloud
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/partitio/gonextcloud/client"
|
import "github.com/partitio/gonextcloud/client"
|
||||||
```
|
```
|
||||||
@ -12,14 +14,14 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/partitio/gonextcloud/client"
|
"github.com/partitio/gonextcloud"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
url := "https://www.mynextcloud.com"
|
url := "https://www.mynextcloud.com"
|
||||||
username := "admin"
|
username := "admin"
|
||||||
password := "password"
|
password := "password"
|
||||||
c, err := client.NewClient(url)
|
c, err := gonextcloud.NewClient(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -30,6 +32,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### type Client
|
#### type Client
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -44,6 +47,42 @@ type Client struct {
|
|||||||
func NewClient(hostname string) (*Client, error)
|
func NewClient(hostname string) (*Client, error)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppDisable
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppDisable(name string) error
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppEnable
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppEnable(name string) error
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppInfos
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppInfos(name string) (types.App, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppList
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppList() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppListDisabled
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppListDisabled() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*Client) AppListEnabled
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) AppListEnabled() ([]string, error)
|
||||||
|
```
|
||||||
|
|
||||||
#### func (*Client) GroupCreate
|
#### func (*Client) GroupCreate
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -101,7 +140,7 @@ func (c *Client) User(name string) (*types.User, error)
|
|||||||
#### func (*Client) UserCreate
|
#### func (*Client) UserCreate
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) UserCreate(username string, password string) error
|
func (c *Client) UserCreate(username string, password string, user *types.User) error
|
||||||
```
|
```
|
||||||
|
|
||||||
#### func (*Client) UserDelete
|
#### func (*Client) UserDelete
|
||||||
@ -176,6 +215,12 @@ func (c *Client) UserSearch(search string) ([]string, error)
|
|||||||
func (c *Client) UserSendWelcomeEmail(name string) error
|
func (c *Client) UserSendWelcomeEmail(name string) error
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### func (*Client) UserUpdate
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *Client) UserUpdate(user *types.User) error
|
||||||
|
```
|
||||||
|
|
||||||
#### func (*Client) UserUpdateAddress
|
#### func (*Client) UserUpdateAddress
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -209,7 +254,7 @@ func (c *Client) UserUpdatePhone(name string, phone string) error
|
|||||||
#### func (*Client) UserUpdateQuota
|
#### func (*Client) UserUpdateQuota
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *Client) UserUpdateQuota(name string, quota string) error
|
func (c *Client) UserUpdateQuota(name string, quota int) error
|
||||||
```
|
```
|
||||||
|
|
||||||
#### func (*Client) UserUpdateTwitter
|
#### func (*Client) UserUpdateTwitter
|
||||||
|
46
interface.go
46
interface.go
@ -1,46 +0,0 @@
|
|||||||
package gonextcloud
|
|
||||||
|
|
||||||
import "github.com/partitio/gonextcloud/types"
|
|
||||||
|
|
||||||
type BaseClient interface {
|
|
||||||
NewClient(hostname string) (*Client, error)
|
|
||||||
|
|
||||||
Login(username string, password string) error
|
|
||||||
Logout() error
|
|
||||||
|
|
||||||
User(name string) (*types.User, error)
|
|
||||||
UserSearch(search string) ([]string, error)
|
|
||||||
UserList() ([]string, error)
|
|
||||||
UserCreate(username string, password string) error
|
|
||||||
UserDelete(name string) error
|
|
||||||
UserDisable(name string) error
|
|
||||||
UserEnable(name string) error
|
|
||||||
UserGroupAdd(name string, group string) error
|
|
||||||
UserGroupDemote(name string, group string) error
|
|
||||||
UserGroupList(name string) ([]string, error)
|
|
||||||
UserGroupPromote(name string, group string) error
|
|
||||||
UserGroupRemove(name string, group string) error
|
|
||||||
UserGroupSubAdminList(name string) ([]string, error)
|
|
||||||
UserSendWelcomeEmail(name string) error
|
|
||||||
|
|
||||||
UserUpdateAddress(name string, address string) error
|
|
||||||
UserUpdateDisplayName(name string, displayName string) error
|
|
||||||
UserUpdateEmail(name string, email string) error
|
|
||||||
UserUpdatePassword(name string, password string) error
|
|
||||||
UserUpdatePhone(name string, phone string) error
|
|
||||||
UserUpdateQuota(name string, quota string) error
|
|
||||||
UserUpdateTwitter(name string, twitter string) error
|
|
||||||
UserUpdateWebSite(name string, website string) error
|
|
||||||
|
|
||||||
GroupSearch(search string) ([]string, error)
|
|
||||||
GroupList() ([]string, error)
|
|
||||||
GroupUsers(name string) ([]string, error)
|
|
||||||
GroupCreate(name string) error
|
|
||||||
GroupDelete(name string) error
|
|
||||||
GroupSubAdminList(name string) ([]string, error)
|
|
||||||
|
|
||||||
AppList() ([]string, error)
|
|
||||||
App(name string) (types.App, error)
|
|
||||||
AppEnable(name string) error
|
|
||||||
AppDisable(name string) error
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user