mirror of
				https://gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud
				synced 2025-11-04 05:11:46 +00:00 
			
		
		
		
	#1 OCS Shares API
This commit is contained in:
		@@ -38,7 +38,7 @@ type UserUpdateError struct {
 | 
			
		||||
func (e *UserUpdateError) Error() string {
 | 
			
		||||
	var errors []string
 | 
			
		||||
	for k, e := range e.Errors {
 | 
			
		||||
		errors = append(errors, fmt.Sprintf("%s: %s", k, e.Error()))
 | 
			
		||||
		errors = append(errors, fmt.Sprintf("%s: %v", k, e))
 | 
			
		||||
	}
 | 
			
		||||
	return strings.Join(errors, ",")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -90,11 +90,21 @@ type CapabilitiesResponse struct {
 | 
			
		||||
 | 
			
		||||
type MonitoringResponse struct {
 | 
			
		||||
	Ocs struct {
 | 
			
		||||
		Meta struct {
 | 
			
		||||
			Status     string `json:"status"`
 | 
			
		||||
			Statuscode int    `json:"statuscode"`
 | 
			
		||||
			Message    string `json:"message"`
 | 
			
		||||
		} `json:"meta"`
 | 
			
		||||
		Meta Meta       `json:"meta"`
 | 
			
		||||
		Data Monitoring `json:"data"`
 | 
			
		||||
	} `json:"ocs"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type SharesListResponse struct {
 | 
			
		||||
	Ocs struct {
 | 
			
		||||
		Meta Meta    `json:"meta"`
 | 
			
		||||
		Data []Share `json:"data"`
 | 
			
		||||
	} `json:"ocs"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type SharesResponse struct {
 | 
			
		||||
	Ocs struct {
 | 
			
		||||
		Meta Meta  `json:"meta"`
 | 
			
		||||
		Data Share `json:"data"`
 | 
			
		||||
	} `json:"ocs"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								types/shares.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								types/shares.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
package types
 | 
			
		||||
 | 
			
		||||
type ShareType int
 | 
			
		||||
type SharePermission int
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	UserShare           ShareType = 0
 | 
			
		||||
	GroupShare          ShareType = 1
 | 
			
		||||
	PublicLinkShare     ShareType = 3
 | 
			
		||||
	FederatedCloudShare ShareType = 6
 | 
			
		||||
 | 
			
		||||
	ReadPermission    SharePermission = 1
 | 
			
		||||
	UpdatePermission  SharePermission = 2
 | 
			
		||||
	CreatePermission  SharePermission = 4
 | 
			
		||||
	DeletePermission  SharePermission = 8
 | 
			
		||||
	ReSharePermission SharePermission = 16
 | 
			
		||||
	AllPermissions    SharePermission = 31
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type ShareUpdate struct {
 | 
			
		||||
	ShareID      int
 | 
			
		||||
	Permissions  SharePermission
 | 
			
		||||
	Password     string
 | 
			
		||||
	PublicUpload bool
 | 
			
		||||
	ExpireDate   string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Share struct {
 | 
			
		||||
	ID                   string      `json:"id"`
 | 
			
		||||
	ShareType            int         `json:"share_type"`
 | 
			
		||||
	UIDOwner             string      `json:"uid_owner"`
 | 
			
		||||
	DisplaynameOwner     string      `json:"displayname_owner"`
 | 
			
		||||
	Permissions          int         `json:"permissions"`
 | 
			
		||||
	Stime                int         `json:"stime"`
 | 
			
		||||
	Parent               interface{} `json:"parent"`
 | 
			
		||||
	Expiration           string      `json:"expiration"`
 | 
			
		||||
	Token                string      `json:"token"`
 | 
			
		||||
	UIDFileOwner         string      `json:"uid_file_owner"`
 | 
			
		||||
	DisplaynameFileOwner string      `json:"displayname_file_owner"`
 | 
			
		||||
	Path                 string      `json:"path"`
 | 
			
		||||
	ItemType             string      `json:"item_type"`
 | 
			
		||||
	Mimetype             string      `json:"mimetype"`
 | 
			
		||||
	StorageID            string      `json:"storage_id"`
 | 
			
		||||
	Storage              int         `json:"storage"`
 | 
			
		||||
	ItemSource           int         `json:"item_source"`
 | 
			
		||||
	FileSource           int         `json:"file_source"`
 | 
			
		||||
	FileParent           int         `json:"file_parent"`
 | 
			
		||||
	FileTarget           string      `json:"file_target"`
 | 
			
		||||
	ShareWith            string      `json:"share_with"`
 | 
			
		||||
	ShareWithDisplayname string      `json:"share_with_displayname"`
 | 
			
		||||
	MailSend             int         `json:"mail_send"`
 | 
			
		||||
	Tags                 []string    `json:"tags"`
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user