improved comments

This commit is contained in:
Adphi 2019-07-23 09:52:34 +02:00
parent 5d284c1ad8
commit 90081d6e8f
12 changed files with 56 additions and 18 deletions

2
app.go
View File

@ -1,6 +1,6 @@
package gonextcloud
//App
// App is a nextcloud application (plugin)
type App struct {
ID string `json:"id"`
Ocsid string `json:"ocsid"`

View File

@ -1,6 +1,6 @@
package gonextcloud
//Capabilities
// Capabilities is the capabilities provided by the Nextcloud server
type Capabilities struct {
Core struct {
Pollinterval int `json:"pollinterval"`

2
doc.go
View File

@ -1,5 +1,5 @@
/*
A simple Go Client for Nextcloud's API.
Package gonextcloud is a simple Go Client for Nextcloud's API.
For more information about the Provisioning API, see the documentation:
https://docs.nextcloud.com/server/13/admin_manual/configuration_user/user_provisioning_api.html

View File

@ -30,7 +30,7 @@ type UpdateError struct {
Error error
}
//UpdateError contains the errors resulting from a UserUpdate or a UserCreateFull call
// UserUpdateError contains the errors resulting from a UserUpdate or a UserCreateFull call
type UserUpdateError struct {
Errors map[string]error
}

View File

@ -13,19 +13,31 @@ func NewClient(hostname string) (Client, error) {
// Client is the main client interface
type Client interface {
// Nextcloud Apps client
Apps() Apps
// Nextcloud App Config client
AppsConfig() AppsConfig
// Nextcloud Group Folders client
GroupFolders() GroupFolders
// Nextcloud Notifications client
Notifications() Notifications
// Nextcloud Shares client
Shares() Shares
// Nextcloud Users client
Users() Users
// Nextcloud Groups client
Groups() Groups
// Nextcloud WebDav (files) client
WebDav() WebDav
// Nextcloud Monitoring client
Monitoring() (*Monitoring, error)
// Login authorize client
Login(username string, password string) error
// Logout clear connetion and session
Logout() error
}
// Auth is the standard auth methods
type Auth interface {
Login(username string, password string) error
Logout() error

View File

@ -1,6 +1,6 @@
package gonextcloud
//Group
// Group is a Nextcloud group
type Group struct {
ID string `json:"id"`
Displayname string `json:"displayname"`

View File

@ -18,6 +18,7 @@ type groupFolderBadFormatGroups struct {
Size int `json:"size"`
}
// GroupFolder is group shared folder from groupfolders application
type GroupFolder struct {
ID int `json:"id"`
MountPoint string `json:"mount_point"`

View File

@ -1,5 +1,6 @@
package gonextcloud
// System contains the operating system statistics
type System struct {
Version string `json:"version"`
Theme string `json:"theme"`
@ -18,7 +19,9 @@ type System struct {
SwapFree int `json:"swap_free"`
}
// Monitoring contains the nextcloud monitoring statistics
type Monitoring struct {
// Nextcloud Statistics
Nextcloud struct {
System System `json:"system"`
Storage Storage `json:"storage"`
@ -32,6 +35,7 @@ type Monitoring struct {
NumFedSharesReceived int `json:"num_fed_shares_received"`
} `json:"shares"`
} `json:"nextcloud"`
// Server statistics
Server struct {
Webserver string `json:"webserver"`
Php struct {
@ -46,15 +50,18 @@ type Monitoring struct {
Size int `json:"size"`
} `json:"database"`
} `json:"server"`
// Active users statistics
ActiveUsers ActiveUsers `json:"activeUsers"`
}
// ActiveUsers contains the active users statistics
type ActiveUsers struct {
Last5Minutes int `json:"last5minutes"`
Last1Hour int `json:"last1hour"`
Last24Hours int `json:"last24hours"`
}
// Storage contains the storage statistics
type Storage struct {
NumUsers int `json:"num_users"`
NumFiles int `json:"num_files"`

View File

@ -2,6 +2,7 @@ package gonextcloud
import "time"
// Notification is a nextcloud notification (from notification app)
type Notification struct {
NotificationID int `json:"notification_id"`
App string `json:"app"`

View File

@ -119,6 +119,7 @@ type capabilitiesResponse struct {
} `json:"ocs"`
}
// Version contains the nextcloud version informations
type Version struct {
Major int `json:"major"`
Minor int `json:"minor"`

View File

@ -1,22 +1,36 @@
package gonextcloud
// ShareType is the nextcloud shares types enum :
type ShareType int
// SharePermission is the nextcloud share permissions enum
type SharePermission int
const (
// UserShare is a file or folder shared with other user(s)
UserShare ShareType = 0
// GroupShare is a file or folder shared with a group
GroupShare ShareType = 1
// PublicLinkShare is a file or folder shared through public link
PublicLinkShare ShareType = 3
// FederatedCloudShare is a file or folder shared through federated cloud
FederatedCloudShare ShareType = 6
// ReadPermission grant read permission
ReadPermission SharePermission = 1
// UpdatePermission grant update permission
UpdatePermission SharePermission = 2
// CreatePermission grant create permission
CreatePermission SharePermission = 4
// DeletePermission grant delete permission
DeletePermission SharePermission = 8
// ReSharePermission grant resharing permission
ReSharePermission SharePermission = 16
// AllPermissions grant all permissions
AllPermissions SharePermission = 31
)
// ShareUpdate contains the data required in order to update a nextcloud share
type ShareUpdate struct {
ShareID int
Permissions SharePermission
@ -25,6 +39,7 @@ type ShareUpdate struct {
ExpireDate string
}
// Share is a nextcloud share
type Share struct {
ID string `json:"id"`
ShareType int `json:"share_type"`

View File

@ -33,6 +33,7 @@ type UserDetails struct {
Locale string `json:"locale,omitempty"`
}
// Quota is a use storage Quota
type Quota struct {
Free int64 `json:"free"`
Used int64 `json:"used"`