2018-07-05 10:50:56 +00:00
|
|
|
|
# [WIP] Nextcloud Go API Client
|
|
|
|
|
|
|
|
|
|
A simple Client for Nextcloud's API in Go.
|
|
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
- [Auth](#authentication)
|
|
|
|
|
- ~~login~~
|
|
|
|
|
- ~~logout~~
|
|
|
|
|
- [Users](#users)
|
|
|
|
|
- ~~search~~
|
|
|
|
|
- ~~list~~
|
|
|
|
|
- ~~get infos~~
|
|
|
|
|
- ~~create~~
|
2018-07-05 13:01:25 +00:00
|
|
|
|
- ~~update~~
|
2018-07-05 10:50:56 +00:00
|
|
|
|
- ~~delete~~
|
2018-07-05 13:01:25 +00:00
|
|
|
|
- ~~enable~~
|
|
|
|
|
- ~~disable~~
|
2018-07-05 14:15:51 +00:00
|
|
|
|
- ~~get groups~~
|
|
|
|
|
- ~~add to group~~
|
|
|
|
|
- ~~remove from group~~
|
|
|
|
|
- ~~get subadmin group~~
|
|
|
|
|
- ~~promote subadmin~~
|
|
|
|
|
- ~~demote subadmin~~
|
2018-07-05 13:01:25 +00:00
|
|
|
|
- ~~send welcome mail~~
|
2018-07-05 10:50:56 +00:00
|
|
|
|
- [Groups](#groups)
|
2018-07-09 11:36:07 +00:00
|
|
|
|
- ~~create~~
|
|
|
|
|
- ~~delete~~
|
|
|
|
|
- ~~get members~~
|
|
|
|
|
- ~~get subadmins~~
|
2018-07-05 10:50:56 +00:00
|
|
|
|
- [Apps](#apps)
|
|
|
|
|
- list
|
|
|
|
|
- get infos
|
|
|
|
|
- enable
|
|
|
|
|
- disable
|
|
|
|
|
|
2018-07-09 11:36:07 +00:00
|
|
|
|
# client
|
|
|
|
|
--
|
2018-07-09 11:37:44 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
import "github.com/partitio/gonextcloud/client"
|
2018-07-09 11:37:44 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```go
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/partitio/gonextcloud/client"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
url := "https://www.mynextcloud.com"
|
|
|
|
|
username := "admin"
|
|
|
|
|
password := "password"
|
|
|
|
|
c, err := client.NewClient(url)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
if err := c.Login(username, password); err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
defer c.Logout()
|
|
|
|
|
}
|
2018-07-09 11:36:07 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func NewClient
|
|
|
|
|
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func NewClient(hostname string) (*Client, error)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Authentication
|
|
|
|
|
#### func (*Client) Login
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) Login(username string, password string) error
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) Logout
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) Logout() error
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
## Users
|
|
|
|
|
#### func (*Client) User
|
|
|
|
|
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```go
|
|
|
|
|
func (c *Client) User(name string) (*types.User, error)
|
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserCreate
|
|
|
|
|
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserCreate(username string, password string) error
|
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserDelete
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserDelete(name string) error
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserDisable
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserDisable(name string) error
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserEnable
|
|
|
|
|
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserEnable(name string) error
|
2018-07-05 10:50:56 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserGroupAdd
|
|
|
|
|
|
2018-07-05 13:01:25 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserGroupAdd(name string, group string) error
|
2018-07-05 13:01:25 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserGroupDemote
|
|
|
|
|
|
2018-07-05 13:01:25 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserGroupDemote(name string, group string) error
|
2018-07-05 13:01:25 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserGroupList
|
|
|
|
|
|
2018-07-05 13:01:25 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserGroupList(name string) ([]string, error)
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserGroupPromote
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserGroupPromote(name string, group string) error
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserGroupRemove
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserGroupRemove(name string, group string) error
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserGroupSubAdminList
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserGroupSubAdminList(name string) ([]string, error)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserList
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserList() ([]string, error)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserSearch
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserSearch(search string) ([]string, error)
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserSendWelcomeEmail
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserSendWelcomeEmail(name string) error
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdateAddress
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-05 13:01:25 +00:00
|
|
|
|
func (c *Client) UserUpdateAddress(name string, address string) error
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdateDisplayName
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserUpdateDisplayName(name string, displayName string) error
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdateEmail
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserUpdateEmail(name string, email string) error
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdatePassword
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-05 13:01:25 +00:00
|
|
|
|
func (c *Client) UserUpdatePassword(name string, password string) error
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdatePhone
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) UserUpdatePhone(name string, phone string) error
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdateQuota
|
|
|
|
|
|
2018-07-05 14:19:55 +00:00
|
|
|
|
```go
|
2018-07-05 13:01:25 +00:00
|
|
|
|
func (c *Client) UserUpdateQuota(name string, quota string) error
|
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdateTwitter
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserUpdateTwitter(name string, twitter string) error
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) UserUpdateWebSite
|
|
|
|
|
|
|
|
|
|
## Groups
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) UserUpdateWebSite(name string, website string) error
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
#### func (*Client) GroupCreate
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) GroupCreate(name string) error
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) GroupDelete
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) GroupDelete(name string) error
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) GroupList
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) GroupList() ([]string, error)
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) GroupSearch
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) GroupSearch(search string) ([]string, error)
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-09 11:36:07 +00:00
|
|
|
|
|
|
|
|
|
#### func (*Client) GroupSubAdminList
|
|
|
|
|
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```go
|
2018-07-09 11:36:07 +00:00
|
|
|
|
func (c *Client) GroupSubAdminList(name string) ([]string, error)
|
2018-07-05 14:15:51 +00:00
|
|
|
|
```
|
2018-07-05 10:50:56 +00:00
|
|
|
|
|
2018-07-09 11:36:07 +00:00
|
|
|
|
#### func (*Client) GroupUsers
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
func (c *Client) GroupUsers(name string) ([]string, error)
|
|
|
|
|
```
|