Fix #1 and #2 : Added groupfolders API client

This commit is contained in:
2018-09-03 12:17:02 +02:00
parent 3c45f09874
commit 359e15bfb2
14 changed files with 380 additions and 104 deletions

57
types/groupfolders.go Normal file
View File

@ -0,0 +1,57 @@
package types
import "strconv"
type GroupFolderBadFormatIDAndGroups struct {
ID string `json:"id"`
MountPoint string `json:"mount_point"`
Groups map[string]string `json:"groups"`
Quota string `json:"quota"`
Size int `json:"size"`
}
type GroupFolderBadFormatGroups struct {
ID int `json:"id"`
MountPoint string `json:"mount_point"`
Groups map[string]string `json:"groups"`
Quota string `json:"quota"`
Size int `json:"size"`
}
type GroupFolder struct {
ID int `json:"id"`
MountPoint string `json:"mount_point"`
Groups map[string]SharePermission `json:"groups"`
Quota int `json:"quota"`
Size int `json:"size"`
}
func (gf *GroupFolderBadFormatGroups) FormatGroupFolder() GroupFolder {
g := GroupFolder{}
g.ID = gf.ID
g.MountPoint = gf.MountPoint
g.Groups = map[string]SharePermission{}
for k, v := range gf.Groups {
p, _ := strconv.Atoi(v)
g.Groups[k] = SharePermission(p)
}
q, _ := strconv.Atoi(gf.Quota)
g.Quota = q
g.Size = gf.Size
return g
}
func (gf *GroupFolderBadFormatIDAndGroups) FormatGroupFolder() GroupFolder {
g := GroupFolder{}
g.ID, _ = strconv.Atoi(gf.ID)
g.MountPoint = gf.MountPoint
g.Groups = map[string]SharePermission{}
for k, v := range gf.Groups {
p, _ := strconv.Atoi(v)
g.Groups[k] = SharePermission(p)
}
q, _ := strconv.Atoi(gf.Quota)
g.Quota = q
g.Size = gf.Size
return g
}

View File

@ -108,3 +108,24 @@ type SharesResponse struct {
Data Share `json:"data"`
} `json:"ocs"`
}
type GroupFoldersListResponse struct {
Ocs struct {
Meta Meta `json:"meta"`
Data map[string]GroupFolderBadFormatIDAndGroups `json:"data"`
} `json:"ocs"`
}
type GroupFoldersCreateResponse struct {
Ocs struct {
Meta Meta `json:"meta"`
Data GroupFolderBadFormatIDAndGroups `json:"data"`
} `json:"ocs"`
}
type GroupFoldersResponse struct {
Ocs struct {
Meta Meta `json:"meta"`
Data GroupFolderBadFormatGroups `json:"data"`
} `json:"ocs"`
}