mirror of
https://gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud
synced 2025-11-05 11:21:45 +00:00
Added User related tests
This commit is contained in:
67
client/types/app.go
Normal file
67
client/types/app.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package types
|
||||
|
||||
type App struct {
|
||||
ID string `json:"id"`
|
||||
Ocsid string `json:"ocsid"`
|
||||
Name string `json:"name"`
|
||||
Summary string `json:"summary"`
|
||||
Description string `json:"description"`
|
||||
Licence string `json:"licence"`
|
||||
Author string `json:"author"`
|
||||
Version string `json:"version"`
|
||||
Namespace string `json:"namespace"`
|
||||
Types []string `json:"types"`
|
||||
Documentation struct {
|
||||
Admin string `json:"admin"`
|
||||
Developer string `json:"developer"`
|
||||
User string `json:"user"`
|
||||
} `json:"documentation"`
|
||||
Category []string `json:"category"`
|
||||
Website string `json:"website"`
|
||||
Bugs string `json:"bugs"`
|
||||
Repository struct {
|
||||
Attributes struct {
|
||||
Type string `json:"type"`
|
||||
} `json:"@attributes"`
|
||||
Value string `json:"@value"`
|
||||
} `json:"repository"`
|
||||
Screenshot []interface{} `json:"screenshot"`
|
||||
Dependencies struct {
|
||||
Owncloud struct {
|
||||
Attributes struct {
|
||||
MinVersion string `json:"min-version"`
|
||||
MaxVersion string `json:"max-version"`
|
||||
} `json:"@attributes"`
|
||||
} `json:"owncloud"`
|
||||
Nextcloud struct {
|
||||
Attributes struct {
|
||||
MinVersion string `json:"min-version"`
|
||||
MaxVersion string `json:"max-version"`
|
||||
} `json:"@attributes"`
|
||||
} `json:"nextcloud"`
|
||||
} `json:"dependencies"`
|
||||
Settings struct {
|
||||
Admin []string `json:"admin"`
|
||||
AdminSection []string `json:"admin-section"`
|
||||
Personal []interface{} `json:"personal"`
|
||||
PersonalSection []interface{} `json:"personal-section"`
|
||||
} `json:"settings"`
|
||||
Info []interface{} `json:"info"`
|
||||
Remote []interface{} `json:"remote"`
|
||||
Public []interface{} `json:"public"`
|
||||
RepairSteps struct {
|
||||
Install []interface{} `json:"install"`
|
||||
PreMigration []interface{} `json:"pre-migration"`
|
||||
PostMigration []interface{} `json:"post-migration"`
|
||||
LiveMigration []interface{} `json:"live-migration"`
|
||||
Uninstall []interface{} `json:"uninstall"`
|
||||
} `json:"repair-steps"`
|
||||
BackgroundJobs []interface{} `json:"background-jobs"`
|
||||
TwoFactorProviders []interface{} `json:"two-factor-providers"`
|
||||
Commands []interface{} `json:"commands"`
|
||||
Activity struct {
|
||||
Filters []interface{} `json:"filters"`
|
||||
Settings []interface{} `json:"settings"`
|
||||
Providers []interface{} `json:"providers"`
|
||||
} `json:"activity"`
|
||||
}
|
||||
19
client/types/errors.go
Normal file
19
client/types/errors.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package types
|
||||
|
||||
import "fmt"
|
||||
|
||||
type APIError struct {
|
||||
Code int
|
||||
Message string
|
||||
}
|
||||
|
||||
func ErrorFromMeta(meta Meta) APIError {
|
||||
return APIError{
|
||||
meta.Statuscode,
|
||||
meta.Message,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *APIError) Error() string {
|
||||
return fmt.Sprintf("%d : %s", e.Code, e.Message)
|
||||
}
|
||||
@@ -1,27 +1,23 @@
|
||||
package types
|
||||
|
||||
type Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
}
|
||||
|
||||
type ErrorResponse struct {
|
||||
Ocs struct {
|
||||
Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
} `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data []interface{} `json:"data"`
|
||||
} `json:"ocs"`
|
||||
}
|
||||
|
||||
type UserListResponse struct {
|
||||
Ocs struct {
|
||||
Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
} `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data struct {
|
||||
Users []string `json:"users"`
|
||||
} `json:"data"`
|
||||
@@ -30,54 +26,46 @@ type UserListResponse struct {
|
||||
|
||||
type UserResponse struct {
|
||||
Ocs struct {
|
||||
Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
} `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data User `json:"data"`
|
||||
} `json:"ocs"`
|
||||
}
|
||||
|
||||
type BaseResponse struct {
|
||||
Ocs struct {
|
||||
Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
} `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data []string `json:"data"`
|
||||
} `json:"ocs"`
|
||||
}
|
||||
|
||||
type GroupListResponse struct {
|
||||
Ocs struct {
|
||||
Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
} `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data struct {
|
||||
Groups []string `json:"groups"`
|
||||
} `json:"data"`
|
||||
} `json:"ocs"`
|
||||
}
|
||||
|
||||
type AppListResponse struct {
|
||||
Ocs struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data struct {
|
||||
Apps []string `json:"apps"`
|
||||
} `json:"data"`
|
||||
} `json:"ocs"`
|
||||
}
|
||||
|
||||
type AppResponse struct {
|
||||
Ocs struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data App `json:"data"`
|
||||
} `json:"ocs"`
|
||||
}
|
||||
|
||||
type CapabilitiesResponse struct {
|
||||
Ocs struct {
|
||||
Meta struct {
|
||||
Status string `json:"status"`
|
||||
Statuscode int `json:"statuscode"`
|
||||
Message string `json:"message"`
|
||||
Totalitems string `json:"totalitems"`
|
||||
Itemsperpage string `json:"itemsperpage"`
|
||||
} `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data struct {
|
||||
Version struct {
|
||||
Major int `json:"major"`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package types
|
||||
|
||||
type User struct {
|
||||
Enabled string `json:"enabled"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ID string `json:"id"`
|
||||
Quota struct {
|
||||
Free int64 `json:"free"`
|
||||
|
||||
Reference in New Issue
Block a user