mirror of
https://gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud
synced 2024-11-13 05:36:24 +00:00
improved comments
This commit is contained in:
parent
5d284c1ad8
commit
90081d6e8f
2
app.go
2
app.go
@ -1,6 +1,6 @@
|
||||
package gonextcloud
|
||||
|
||||
//App
|
||||
// App is a nextcloud application (plugin)
|
||||
type App struct {
|
||||
ID string `json:"id"`
|
||||
Ocsid string `json:"ocsid"`
|
||||
|
@ -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
2
doc.go
@ -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
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
//APIError contains the returned error code and message from the Nextcloud's API
|
||||
// APIError contains the returned error code and message from the Nextcloud's API
|
||||
type APIError struct {
|
||||
Code int
|
||||
Message string
|
||||
@ -19,18 +19,18 @@ func errorFromMeta(meta meta) *APIError {
|
||||
}
|
||||
}
|
||||
|
||||
//Error return the types.APIError string
|
||||
// Error return the types.APIError string
|
||||
func (e *APIError) Error() string {
|
||||
return fmt.Sprintf("%d : %s", e.Code, e.Message)
|
||||
}
|
||||
|
||||
//UpdateError contains the user's field and corresponding error
|
||||
// UpdateError contains the user's field and corresponding error
|
||||
type UpdateError struct {
|
||||
Field string
|
||||
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
|
||||
}
|
||||
|
@ -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
|
||||
|
2
group.go
2
group.go
@ -1,6 +1,6 @@
|
||||
package gonextcloud
|
||||
|
||||
//Group
|
||||
// Group is a Nextcloud group
|
||||
type Group struct {
|
||||
ID string `json:"id"`
|
||||
Displayname string `json:"displayname"`
|
||||
|
@ -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"`
|
||||
|
@ -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"`
|
||||
|
@ -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"`
|
||||
|
@ -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"`
|
||||
|
31
shares.go
31
shares.go
@ -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 ShareType = 0
|
||||
GroupShare ShareType = 1
|
||||
PublicLinkShare ShareType = 3
|
||||
// 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 SharePermission = 1
|
||||
UpdatePermission SharePermission = 2
|
||||
CreatePermission SharePermission = 4
|
||||
DeletePermission SharePermission = 8
|
||||
// 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 SharePermission = 31
|
||||
// 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"`
|
||||
|
5
user.go
5
user.go
@ -2,7 +2,7 @@ package gonextcloud
|
||||
|
||||
import "strconv"
|
||||
|
||||
//User encapsulate the data needed to create a new Nextcloud's User
|
||||
// User encapsulate the data needed to create a new Nextcloud's User
|
||||
type User struct {
|
||||
Username string
|
||||
Email string
|
||||
@ -12,7 +12,7 @@ type User struct {
|
||||
Groups []string
|
||||
}
|
||||
|
||||
//UserDetails is the raw Nextcloud User response
|
||||
// UserDetails is the raw Nextcloud User response
|
||||
type UserDetails struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
ID string `json:"id"`
|
||||
@ -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"`
|
||||
|
Loading…
Reference in New Issue
Block a user