diff --git a/changelog/unreleased/graph-permission-created-date.md b/changelog/unreleased/graph-permission-created-date.md new file mode 100644 index 0000000000..cb9e1d4daf --- /dev/null +++ b/changelog/unreleased/graph-permission-created-date.md @@ -0,0 +1,6 @@ +Enhancement: Graph permission created date time + +We've added the created date time to graph permission objects. + +https://github.com/owncloud/ocis/pull/8954 +https://github.com/owncloud/ocis/issues/8749 diff --git a/go.mod b/go.mod index 19d5780ba6..f93a0583a6 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/onsi/gomega v1.33.0 github.com/open-policy-agent/opa v0.64.1 github.com/orcaman/concurrent-map v1.0.0 - github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1 + github.com/owncloud/libre-graph-api-go v1.0.5-0.20240425090020-dba6d1507c38 github.com/pkg/errors v0.9.1 github.com/pkg/xattr v0.4.9 github.com/prometheus/client_golang v1.19.0 diff --git a/go.sum b/go.sum index 84d0d76384..5865a9f15f 100644 --- a/go.sum +++ b/go.sum @@ -1801,8 +1801,8 @@ github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35uk github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY= github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA= -github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1 h1:QLEERCsKv9VhkQaCP5zMEPdAqJLp/iuyogrg/eTfISg= -github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs= +github.com/owncloud/libre-graph-api-go v1.0.5-0.20240425090020-dba6d1507c38 h1:Ld9bPh0c4y1H22mhiWZBw4AoupWjg8L0WLKX0hfbJho= +github.com/owncloud/libre-graph-api-go v1.0.5-0.20240425090020-dba6d1507c38/go.mod h1:yXI+rmE8yYx+ZsGVrnCpprw/gZMcxjwntnX2y2+VKxY= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= diff --git a/services/graph/pkg/service/v0/base.go b/services/graph/pkg/service/v0/base.go index 69f4d46975..f78a182c9d 100644 --- a/services/graph/pkg/service/v0/base.go +++ b/services/graph/pkg/service/v0/base.go @@ -16,12 +16,13 @@ import ( link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + libregraph "github.com/owncloud/libre-graph-api-go" + "google.golang.org/protobuf/types/known/fieldmaskpb" + "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/share" "github.com/cs3org/reva/v2/pkg/storagespace" "github.com/cs3org/reva/v2/pkg/utils" - libregraph "github.com/owncloud/libre-graph-api-go" - "google.golang.org/protobuf/types/known/fieldmaskpb" "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/services/graph/pkg/config" @@ -223,6 +224,11 @@ func (g BaseGraphService) libreGraphPermissionFromCS3PublicShare(createdLink *li perm.SetExpirationDateTime(cs3TimestampToTime(createdLink.GetExpiration()).UTC()) } + // set cTime + if createdLink.GetCtime() != nil { + perm.SetCreatedDateTime(cs3TimestampToTime(createdLink.GetCtime()).UTC()) + } + perm.SetHasPassword(createdLink.GetPasswordProtected()) return perm, nil @@ -372,6 +378,10 @@ func (g BaseGraphService) cs3UserShareToPermission(ctx context.Context, share *c if share.GetExpiration() != nil { perm.SetExpirationDateTime(cs3TimestampToTime(share.GetExpiration())) } + // set cTime + if share.GetCtime() != nil { + perm.SetCreatedDateTime(cs3TimestampToTime(share.GetCtime())) + } role := unifiedrole.CS3ResourcePermissionsToUnifiedRole( *share.GetPermissions().GetPermissions(), roleCondition, diff --git a/services/graph/pkg/service/v0/utils.go b/services/graph/pkg/service/v0/utils.go index 4a7ce93903..3daf87b2a1 100644 --- a/services/graph/pkg/service/v0/utils.go +++ b/services/graph/pkg/service/v0/utils.go @@ -409,6 +409,10 @@ func cs3ReceivedShareToLibreGraphPermissions(ctx context.Context, logger *log.Lo permission.SetExpirationDateTime(cs3TimestampToTime(expiration)) } + if cTime := receivedShare.GetShare().GetCtime(); cTime != nil { + permission.SetCreatedDateTime(cs3TimestampToTime(cTime)) + } + if permissionSet := receivedShare.GetShare().GetPermissions().GetPermissions(); permissionSet != nil { condition, err := roleConditionForResourceType(resourceInfo) if err != nil { diff --git a/vendor/github.com/owncloud/libre-graph-api-go/README.md b/vendor/github.com/owncloud/libre-graph-api-go/README.md index f5d8162e77..1528b771d9 100644 --- a/vendor/github.com/owncloud/libre-graph-api-go/README.md +++ b/vendor/github.com/owncloud/libre-graph-api-go/README.md @@ -80,6 +80,8 @@ Class | Method | HTTP request | Description *ApplicationsApi* | [**GetApplication**](docs/ApplicationsApi.md#getapplication) | **Get** /v1.0/applications/{application-id} | Get application by id *ApplicationsApi* | [**ListApplications**](docs/ApplicationsApi.md#listapplications) | **Get** /v1.0/applications | Get all applications *DriveItemApi* | [**DeleteDriveItem**](docs/DriveItemApi.md#deletedriveitem) | **Delete** /v1beta1/drives/{drive-id}/items/{item-id} | Delete a DriveItem. +*DriveItemApi* | [**GetDriveItem**](docs/DriveItemApi.md#getdriveitem) | **Get** /v1beta1/drives/{drive-id}/items/{item-id} | Get a DriveItem. +*DriveItemApi* | [**UpdateDriveItem**](docs/DriveItemApi.md#updatedriveitem) | **Patch** /v1beta1/drives/{drive-id}/items/{item-id} | Update a DriveItem. *DrivesApi* | [**CreateDrive**](docs/DrivesApi.md#createdrive) | **Post** /v1.0/drives | Create a new drive of a specific type *DrivesApi* | [**DeleteDrive**](docs/DrivesApi.md#deletedrive) | **Delete** /v1.0/drives/{drive-id} | Delete a specific space *DrivesApi* | [**GetDrive**](docs/DrivesApi.md#getdrive) | **Get** /v1.0/drives/{drive-id} | Get drive by id @@ -94,7 +96,14 @@ Class | Method | HTTP request | Description *DrivesPermissionsApi* | [**SetPermissionPassword**](docs/DrivesPermissionsApi.md#setpermissionpassword) | **Post** /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id}/setPassword | Set sharing link password *DrivesPermissionsApi* | [**UpdatePermission**](docs/DrivesPermissionsApi.md#updatepermission) | **Patch** /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Update sharing permission *DrivesRootApi* | [**CreateDriveItem**](docs/DrivesRootApi.md#createdriveitem) | **Post** /v1beta1/drives/{drive-id}/root/children | Create a drive item +*DrivesRootApi* | [**CreateLinkSpaceRoot**](docs/DrivesRootApi.md#createlinkspaceroot) | **Post** /v1beta1/drives/{drive-id}/root/createLink | Create a sharing link for the root item of a Drive +*DrivesRootApi* | [**DeletePermissionSpaceRoot**](docs/DrivesRootApi.md#deletepermissionspaceroot) | **Delete** /v1beta1/drives/{drive-id}/root/permissions/{perm-id} | Remove access to a Drive +*DrivesRootApi* | [**GetPermissionSpaceRoot**](docs/DrivesRootApi.md#getpermissionspaceroot) | **Get** /v1beta1/drives/{drive-id}/root/permissions/{perm-id} | Get a single sharing permission for the root item of a drive *DrivesRootApi* | [**GetRoot**](docs/DrivesRootApi.md#getroot) | **Get** /v1.0/drives/{drive-id}/root | Get root from arbitrary space +*DrivesRootApi* | [**InviteSpaceRoot**](docs/DrivesRootApi.md#invitespaceroot) | **Post** /v1beta1/drives/{drive-id}/root/invite | Send a sharing invitation +*DrivesRootApi* | [**ListPermissionsSpaceRoot**](docs/DrivesRootApi.md#listpermissionsspaceroot) | **Get** /v1beta1/drives/{drive-id}/root/permissions | List the effective permissions on the root item of a drive. +*DrivesRootApi* | [**SetPermissionPasswordSpaceRoot**](docs/DrivesRootApi.md#setpermissionpasswordspaceroot) | **Post** /v1beta1/drives/{drive-id}/root/permissions/{perm-id}/setPassword | Set sharing link password for the root item of a drive +*DrivesRootApi* | [**UpdatePermissionSpaceRoot**](docs/DrivesRootApi.md#updatepermissionspaceroot) | **Patch** /v1beta1/drives/{drive-id}/root/permissions/{perm-id} | Update sharing permission *EducationClassApi* | [**AddUserToClass**](docs/EducationClassApi.md#addusertoclass) | **Post** /v1.0/education/classes/{class-id}/members/$ref | Assign a user to a class *EducationClassApi* | [**CreateClass**](docs/EducationClassApi.md#createclass) | **Post** /v1.0/education/classes | Add new education class *EducationClassApi* | [**DeleteClass**](docs/EducationClassApi.md#deleteclass) | **Delete** /v1.0/education/classes/{class-id} | Delete education class @@ -222,6 +231,8 @@ Class | Method | HTTP request | Description - [SpecialFolder](docs/SpecialFolder.md) - [TagAssignment](docs/TagAssignment.md) - [TagUnassignment](docs/TagUnassignment.md) + - [Thumbnail](docs/Thumbnail.md) + - [ThumbnailSet](docs/ThumbnailSet.md) - [Trash](docs/Trash.md) - [UnifiedRoleDefinition](docs/UnifiedRoleDefinition.md) - [UnifiedRolePermission](docs/UnifiedRolePermission.md) diff --git a/vendor/github.com/owncloud/libre-graph-api-go/api_drive_item.go b/vendor/github.com/owncloud/libre-graph-api-go/api_drive_item.go index ce8fb23579..25fc896dc0 100644 --- a/vendor/github.com/owncloud/libre-graph-api-go/api_drive_item.go +++ b/vendor/github.com/owncloud/libre-graph-api-go/api_drive_item.go @@ -130,3 +130,254 @@ func (a *DriveItemApiService) DeleteDriveItemExecute(r ApiDeleteDriveItemRequest return localVarHTTPResponse, nil } + +type ApiGetDriveItemRequest struct { + ctx context.Context + ApiService *DriveItemApiService + driveId string + itemId string +} + +func (r ApiGetDriveItemRequest) Execute() (*DriveItem, *http.Response, error) { + return r.ApiService.GetDriveItemExecute(r) +} + +/* +GetDriveItem Get a DriveItem. + +Get a DriveItem by using its ID. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @param itemId key: id of item + @return ApiGetDriveItemRequest +*/ +func (a *DriveItemApiService) GetDriveItem(ctx context.Context, driveId string, itemId string) ApiGetDriveItemRequest { + return ApiGetDriveItemRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + itemId: itemId, + } +} + +// Execute executes the request +// @return DriveItem +func (a *DriveItemApiService) GetDriveItemExecute(r ApiGetDriveItemRequest) (*DriveItem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DriveItem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DriveItemApiService.GetDriveItem") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateDriveItemRequest struct { + ctx context.Context + ApiService *DriveItemApiService + driveId string + itemId string + driveItem *DriveItem +} + +// DriveItem properties to update +func (r ApiUpdateDriveItemRequest) DriveItem(driveItem DriveItem) ApiUpdateDriveItemRequest { + r.driveItem = &driveItem + return r +} + +func (r ApiUpdateDriveItemRequest) Execute() (*DriveItem, *http.Response, error) { + return r.ApiService.UpdateDriveItemExecute(r) +} + +/* +UpdateDriveItem Update a DriveItem. + +Update a DriveItem. + +The request body must include a JSON object with the properties to update. +Only the properties that are provided will be updated. + +Currently it supports updating the following properties: + +* `@UI.Hidden` - Hides the item from the UI. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @param itemId key: id of item + @return ApiUpdateDriveItemRequest +*/ +func (a *DriveItemApiService) UpdateDriveItem(ctx context.Context, driveId string, itemId string) ApiUpdateDriveItemRequest { + return ApiUpdateDriveItemRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + itemId: itemId, + } +} + +// Execute executes the request +// @return DriveItem +func (a *DriveItemApiService) UpdateDriveItemExecute(r ApiUpdateDriveItemRequest) (*DriveItem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DriveItem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DriveItemApiService.UpdateDriveItem") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.driveItem == nil { + return localVarReturnValue, nil, reportError("driveItem is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.driveItem + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/owncloud/libre-graph-api-go/api_drives_root.go b/vendor/github.com/owncloud/libre-graph-api-go/api_drives_root.go index 8dd48fc81d..ef368dcadd 100644 --- a/vendor/github.com/owncloud/libre-graph-api-go/api_drives_root.go +++ b/vendor/github.com/owncloud/libre-graph-api-go/api_drives_root.go @@ -143,6 +143,364 @@ func (a *DrivesRootApiService) CreateDriveItemExecute(r ApiCreateDriveItemReques return localVarReturnValue, localVarHTTPResponse, nil } +type ApiCreateLinkSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string + driveItemCreateLink *DriveItemCreateLink +} + +// In the request body, provide a JSON object with the following parameters. +func (r ApiCreateLinkSpaceRootRequest) DriveItemCreateLink(driveItemCreateLink DriveItemCreateLink) ApiCreateLinkSpaceRootRequest { + r.driveItemCreateLink = &driveItemCreateLink + return r +} + +func (r ApiCreateLinkSpaceRootRequest) Execute() (*Permission, *http.Response, error) { + return r.ApiService.CreateLinkSpaceRootExecute(r) +} + +/* +CreateLinkSpaceRoot Create a sharing link for the root item of a Drive + +You can use the createLink action to share a driveItem via a sharing link. + +The response will be a permission object with the link facet containing the created link details. + +## Link types + +For now, The following values are allowed for the type parameter. + +| Value | Display name | Description | +| -------------- | ----------------- | --------------------------------------------------------------- | +| view | View | Creates a read-only link to the driveItem. | +| upload | Upload | Creates a read-write link to the folder driveItem. | +| edit | Edit | Creates a read-write link to the driveItem. | +| createOnly | File Drop | Creates an upload-only link to the folder driveItem. | +| blocksDownload | Secure View | Creates a read-only link that blocks download to the driveItem. | + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @return ApiCreateLinkSpaceRootRequest +*/ +func (a *DrivesRootApiService) CreateLinkSpaceRoot(ctx context.Context, driveId string) ApiCreateLinkSpaceRootRequest { + return ApiCreateLinkSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + } +} + +// Execute executes the request +// @return Permission +func (a *DrivesRootApiService) CreateLinkSpaceRootExecute(r ApiCreateLinkSpaceRootRequest) (*Permission, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Permission + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.CreateLinkSpaceRoot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/createLink" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.driveItemCreateLink + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeletePermissionSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string + permId string +} + +func (r ApiDeletePermissionSpaceRootRequest) Execute() (*http.Response, error) { + return r.ApiService.DeletePermissionSpaceRootExecute(r) +} + +/* +DeletePermissionSpaceRoot Remove access to a Drive + +Remove access to the root item of a drive. + +Only sharing permissions that are not inherited can be deleted. The `inheritedFrom` property must be `null`. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @param permId key: id of permission + @return ApiDeletePermissionSpaceRootRequest +*/ +func (a *DrivesRootApiService) DeletePermissionSpaceRoot(ctx context.Context, driveId string, permId string) ApiDeletePermissionSpaceRootRequest { + return ApiDeletePermissionSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + permId: permId, + } +} + +// Execute executes the request +func (a *DrivesRootApiService) DeletePermissionSpaceRootExecute(r ApiDeletePermissionSpaceRootRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.DeletePermissionSpaceRoot") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/permissions/{perm-id}" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetPermissionSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string + permId string +} + +func (r ApiGetPermissionSpaceRootRequest) Execute() (*Permission, *http.Response, error) { + return r.ApiService.GetPermissionSpaceRootExecute(r) +} + +/* +GetPermissionSpaceRoot Get a single sharing permission for the root item of a drive + +Return the effective sharing permission for a particular permission resource. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @param permId key: id of permission + @return ApiGetPermissionSpaceRootRequest +*/ +func (a *DrivesRootApiService) GetPermissionSpaceRoot(ctx context.Context, driveId string, permId string) ApiGetPermissionSpaceRootRequest { + return ApiGetPermissionSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + permId: permId, + } +} + +// Execute executes the request +// @return Permission +func (a *DrivesRootApiService) GetPermissionSpaceRootExecute(r ApiGetPermissionSpaceRootRequest) (*Permission, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Permission + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.GetPermissionSpaceRoot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/permissions/{perm-id}" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiGetRootRequest struct { ctx context.Context ApiService *DrivesRootApiService @@ -251,3 +609,521 @@ func (a *DrivesRootApiService) GetRootExecute(r ApiGetRootRequest) (*DriveItem, return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiInviteSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string + driveItemInvite *DriveItemInvite +} + +// In the request body, provide a JSON object with the following parameters. To create a custom role submit a list of actions instead of roles. +func (r ApiInviteSpaceRootRequest) DriveItemInvite(driveItemInvite DriveItemInvite) ApiInviteSpaceRootRequest { + r.driveItemInvite = &driveItemInvite + return r +} + +func (r ApiInviteSpaceRootRequest) Execute() (*CollectionOfPermissions, *http.Response, error) { + return r.ApiService.InviteSpaceRootExecute(r) +} + +/* +InviteSpaceRoot Send a sharing invitation + +Sends a sharing invitation for the root of a `drive`. A sharing invitation provides permissions to the +recipients and optionally sends them an email with a sharing link. + +The response will be a permission object with the grantedToV2 property containing the created grant details. + +## Roles property values +For now, roles are only identified by a uuid. There are no hardcoded aliases like `read` or `write` because role actions can be completely customized. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @return ApiInviteSpaceRootRequest +*/ +func (a *DrivesRootApiService) InviteSpaceRoot(ctx context.Context, driveId string) ApiInviteSpaceRootRequest { + return ApiInviteSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + } +} + +// Execute executes the request +// @return CollectionOfPermissions +func (a *DrivesRootApiService) InviteSpaceRootExecute(r ApiInviteSpaceRootRequest) (*CollectionOfPermissions, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CollectionOfPermissions + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.InviteSpaceRoot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/invite" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.driveItemInvite + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListPermissionsSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string +} + +func (r ApiListPermissionsSpaceRootRequest) Execute() (*CollectionOfPermissionsWithAllowedValues, *http.Response, error) { + return r.ApiService.ListPermissionsSpaceRootExecute(r) +} + +/* +ListPermissionsSpaceRoot List the effective permissions on the root item of a drive. + +The permissions collection includes potentially sensitive information and may not be available for every caller. + +* For the owner of the item, all sharing permissions will be returned. This includes co-owners. +* For a non-owner caller, only the sharing permissions that apply to the caller are returned. +* Sharing permission properties that contain secrets (e.g. `webUrl`) are only returned for callers that are able to create the sharing permission. + +All permission objects have an `id`. A permission representing +* a link has the `link` facet filled with details. +* a share has the `roles` property set and the `grantedToV2` property filled with the grant recipient details. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @return ApiListPermissionsSpaceRootRequest +*/ +func (a *DrivesRootApiService) ListPermissionsSpaceRoot(ctx context.Context, driveId string) ApiListPermissionsSpaceRootRequest { + return ApiListPermissionsSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + } +} + +// Execute executes the request +// @return CollectionOfPermissionsWithAllowedValues +func (a *DrivesRootApiService) ListPermissionsSpaceRootExecute(r ApiListPermissionsSpaceRootRequest) (*CollectionOfPermissionsWithAllowedValues, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CollectionOfPermissionsWithAllowedValues + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.ListPermissionsSpaceRoot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSetPermissionPasswordSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string + permId string + sharingLinkPassword *SharingLinkPassword +} + +// New password value +func (r ApiSetPermissionPasswordSpaceRootRequest) SharingLinkPassword(sharingLinkPassword SharingLinkPassword) ApiSetPermissionPasswordSpaceRootRequest { + r.sharingLinkPassword = &sharingLinkPassword + return r +} + +func (r ApiSetPermissionPasswordSpaceRootRequest) Execute() (*Permission, *http.Response, error) { + return r.ApiService.SetPermissionPasswordSpaceRootExecute(r) +} + +/* +SetPermissionPasswordSpaceRoot Set sharing link password for the root item of a drive + +Set the password of a sharing permission. + +Only the `password` property can be modified this way. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @param permId key: id of permission + @return ApiSetPermissionPasswordSpaceRootRequest +*/ +func (a *DrivesRootApiService) SetPermissionPasswordSpaceRoot(ctx context.Context, driveId string, permId string) ApiSetPermissionPasswordSpaceRootRequest { + return ApiSetPermissionPasswordSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + permId: permId, + } +} + +// Execute executes the request +// @return Permission +func (a *DrivesRootApiService) SetPermissionPasswordSpaceRootExecute(r ApiSetPermissionPasswordSpaceRootRequest) (*Permission, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Permission + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.SetPermissionPasswordSpaceRoot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/permissions/{perm-id}/setPassword" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.sharingLinkPassword == nil { + return localVarReturnValue, nil, reportError("sharingLinkPassword is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sharingLinkPassword + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdatePermissionSpaceRootRequest struct { + ctx context.Context + ApiService *DrivesRootApiService + driveId string + permId string + permission *Permission +} + +// New property values +func (r ApiUpdatePermissionSpaceRootRequest) Permission(permission Permission) ApiUpdatePermissionSpaceRootRequest { + r.permission = &permission + return r +} + +func (r ApiUpdatePermissionSpaceRootRequest) Execute() (*Permission, *http.Response, error) { + return r.ApiService.UpdatePermissionSpaceRootExecute(r) +} + +/* +UpdatePermissionSpaceRoot Update sharing permission + +Update the properties of a sharing permission by patching the permission resource. + +Only the `roles`, `expirationDateTime` and `password` properties can be modified this way. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param driveId key: id of drive + @param permId key: id of permission + @return ApiUpdatePermissionSpaceRootRequest +*/ +func (a *DrivesRootApiService) UpdatePermissionSpaceRoot(ctx context.Context, driveId string, permId string) ApiUpdatePermissionSpaceRootRequest { + return ApiUpdatePermissionSpaceRootRequest{ + ApiService: a, + ctx: ctx, + driveId: driveId, + permId: permId, + } +} + +// Execute executes the request +// @return Permission +func (a *DrivesRootApiService) UpdatePermissionSpaceRootExecute(r ApiUpdatePermissionSpaceRootRequest) (*Permission, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Permission + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesRootApiService.UpdatePermissionSpaceRoot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/root/permissions/{perm-id}" + localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.permission == nil { + return localVarReturnValue, nil, reportError("permission is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.permission + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v OdataError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/owncloud/libre-graph-api-go/model_drive_item.go b/vendor/github.com/owncloud/libre-graph-api-go/model_drive_item.go index 916578c135..e1b71371f3 100644 --- a/vendor/github.com/owncloud/libre-graph-api-go/model_drive_item.go +++ b/vendor/github.com/owncloud/libre-graph-api-go/model_drive_item.go @@ -48,6 +48,8 @@ type DriveItem struct { Image *Image `json:"image,omitempty"` Photo *Photo `json:"photo,omitempty"` Location *GeoCoordinates `json:"location,omitempty"` + // Collection containing ThumbnailSet objects associated with the item. Read-only. Nullable. + Thumbnails []ThumbnailSet `json:"thumbnails,omitempty"` // If this property is non-null, it indicates that the driveItem is the top-most driveItem in the drive. Root map[string]interface{} `json:"root,omitempty"` Trash *Trash `json:"trash,omitempty"` @@ -694,6 +696,38 @@ func (o *DriveItem) SetLocation(v GeoCoordinates) { o.Location = &v } +// GetThumbnails returns the Thumbnails field value if set, zero value otherwise. +func (o *DriveItem) GetThumbnails() []ThumbnailSet { + if o == nil || IsNil(o.Thumbnails) { + var ret []ThumbnailSet + return ret + } + return o.Thumbnails +} + +// GetThumbnailsOk returns a tuple with the Thumbnails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DriveItem) GetThumbnailsOk() ([]ThumbnailSet, bool) { + if o == nil || IsNil(o.Thumbnails) { + return nil, false + } + return o.Thumbnails, true +} + +// HasThumbnails returns a boolean if a field has been set. +func (o *DriveItem) HasThumbnails() bool { + if o != nil && !IsNil(o.Thumbnails) { + return true + } + + return false +} + +// SetThumbnails gets a reference to the given []ThumbnailSet and assigns it to the Thumbnails field. +func (o *DriveItem) SetThumbnails(v []ThumbnailSet) { + o.Thumbnails = v +} + // GetRoot returns the Root field value if set, zero value otherwise. func (o *DriveItem) GetRoot() map[string]interface{} { if o == nil || IsNil(o.Root) { @@ -1145,6 +1179,9 @@ func (o DriveItem) ToMap() (map[string]interface{}, error) { if !IsNil(o.Location) { toSerialize["location"] = o.Location } + if !IsNil(o.Thumbnails) { + toSerialize["thumbnails"] = o.Thumbnails + } if !IsNil(o.Root) { toSerialize["root"] = o.Root } diff --git a/vendor/github.com/owncloud/libre-graph-api-go/model_permission.go b/vendor/github.com/owncloud/libre-graph-api-go/model_permission.go index 49ed4f6b9e..a7360cd0e2 100644 --- a/vendor/github.com/owncloud/libre-graph-api-go/model_permission.go +++ b/vendor/github.com/owncloud/libre-graph-api-go/model_permission.go @@ -25,10 +25,12 @@ type Permission struct { // Indicates whether the password is set for this permission. This property only appears in the response. Optional. Read-only. HasPassword *bool `json:"hasPassword,omitempty"` // An optional expiration date which limits the permission in time. - ExpirationDateTime NullableTime `json:"expirationDateTime,omitempty"` - GrantedToV2 *SharePointIdentitySet `json:"grantedToV2,omitempty"` - Link *SharingLink `json:"link,omitempty"` - Roles []string `json:"roles,omitempty"` + ExpirationDateTime NullableTime `json:"expirationDateTime,omitempty"` + // An optional creation date. Libregraph only. + CreatedDateTime NullableTime `json:"createdDateTime,omitempty"` + GrantedToV2 *SharePointIdentitySet `json:"grantedToV2,omitempty"` + Link *SharingLink `json:"link,omitempty"` + Roles []string `json:"roles,omitempty"` // For link type permissions, the details of the identity to whom permission was granted. This could be used to grant access to a an external user that can be identified by email, aka guest accounts. // Deprecated GrantedToIdentities []IdentitySet `json:"grantedToIdentities,omitempty"` @@ -161,6 +163,49 @@ func (o *Permission) UnsetExpirationDateTime() { o.ExpirationDateTime.Unset() } +// GetCreatedDateTime returns the CreatedDateTime field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Permission) GetCreatedDateTime() time.Time { + if o == nil || IsNil(o.CreatedDateTime.Get()) { + var ret time.Time + return ret + } + return *o.CreatedDateTime.Get() +} + +// GetCreatedDateTimeOk returns a tuple with the CreatedDateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Permission) GetCreatedDateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedDateTime.Get(), o.CreatedDateTime.IsSet() +} + +// HasCreatedDateTime returns a boolean if a field has been set. +func (o *Permission) HasCreatedDateTime() bool { + if o != nil && o.CreatedDateTime.IsSet() { + return true + } + + return false +} + +// SetCreatedDateTime gets a reference to the given NullableTime and assigns it to the CreatedDateTime field. +func (o *Permission) SetCreatedDateTime(v time.Time) { + o.CreatedDateTime.Set(&v) +} + +// SetCreatedDateTimeNil sets the value for CreatedDateTime to be an explicit nil +func (o *Permission) SetCreatedDateTimeNil() { + o.CreatedDateTime.Set(nil) +} + +// UnsetCreatedDateTime ensures that no value is present for CreatedDateTime, not even an explicit nil +func (o *Permission) UnsetCreatedDateTime() { + o.CreatedDateTime.Unset() +} + // GetGrantedToV2 returns the GrantedToV2 field value if set, zero value otherwise. func (o *Permission) GetGrantedToV2() SharePointIdentitySet { if o == nil || IsNil(o.GrantedToV2) { @@ -375,6 +420,9 @@ func (o Permission) ToMap() (map[string]interface{}, error) { if o.ExpirationDateTime.IsSet() { toSerialize["expirationDateTime"] = o.ExpirationDateTime.Get() } + if o.CreatedDateTime.IsSet() { + toSerialize["createdDateTime"] = o.CreatedDateTime.Get() + } if !IsNil(o.GrantedToV2) { toSerialize["grantedToV2"] = o.GrantedToV2 } diff --git a/vendor/github.com/owncloud/libre-graph-api-go/model_thumbnail.go b/vendor/github.com/owncloud/libre-graph-api-go/model_thumbnail.go new file mode 100644 index 0000000000..13cc2580a7 --- /dev/null +++ b/vendor/github.com/owncloud/libre-graph-api-go/model_thumbnail.go @@ -0,0 +1,273 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the Thumbnail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Thumbnail{} + +// Thumbnail The thumbnail resource type represents a thumbnail for an image, video, document, or any item that has a bitmap representation. +type Thumbnail struct { + // The content stream for the thumbnail. + Content *string `json:"content,omitempty"` + // The height of the thumbnail, in pixels. + Height *int32 `json:"height,omitempty"` + // The unique identifier of the item that provided the thumbnail. This is only available when a folder thumbnail is requested. + SourceItemId *string `json:"sourceItemId,omitempty"` + // The URL used to fetch the thumbnail content. + Url *string `json:"url,omitempty"` + // The width of the thumbnail, in pixels. + Width *int32 `json:"width,omitempty"` +} + +// NewThumbnail instantiates a new Thumbnail object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewThumbnail() *Thumbnail { + this := Thumbnail{} + return &this +} + +// NewThumbnailWithDefaults instantiates a new Thumbnail object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewThumbnailWithDefaults() *Thumbnail { + this := Thumbnail{} + return &this +} + +// GetContent returns the Content field value if set, zero value otherwise. +func (o *Thumbnail) GetContent() string { + if o == nil || IsNil(o.Content) { + var ret string + return ret + } + return *o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Thumbnail) GetContentOk() (*string, bool) { + if o == nil || IsNil(o.Content) { + return nil, false + } + return o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *Thumbnail) HasContent() bool { + if o != nil && !IsNil(o.Content) { + return true + } + + return false +} + +// SetContent gets a reference to the given string and assigns it to the Content field. +func (o *Thumbnail) SetContent(v string) { + o.Content = &v +} + +// GetHeight returns the Height field value if set, zero value otherwise. +func (o *Thumbnail) GetHeight() int32 { + if o == nil || IsNil(o.Height) { + var ret int32 + return ret + } + return *o.Height +} + +// GetHeightOk returns a tuple with the Height field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Thumbnail) GetHeightOk() (*int32, bool) { + if o == nil || IsNil(o.Height) { + return nil, false + } + return o.Height, true +} + +// HasHeight returns a boolean if a field has been set. +func (o *Thumbnail) HasHeight() bool { + if o != nil && !IsNil(o.Height) { + return true + } + + return false +} + +// SetHeight gets a reference to the given int32 and assigns it to the Height field. +func (o *Thumbnail) SetHeight(v int32) { + o.Height = &v +} + +// GetSourceItemId returns the SourceItemId field value if set, zero value otherwise. +func (o *Thumbnail) GetSourceItemId() string { + if o == nil || IsNil(o.SourceItemId) { + var ret string + return ret + } + return *o.SourceItemId +} + +// GetSourceItemIdOk returns a tuple with the SourceItemId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Thumbnail) GetSourceItemIdOk() (*string, bool) { + if o == nil || IsNil(o.SourceItemId) { + return nil, false + } + return o.SourceItemId, true +} + +// HasSourceItemId returns a boolean if a field has been set. +func (o *Thumbnail) HasSourceItemId() bool { + if o != nil && !IsNil(o.SourceItemId) { + return true + } + + return false +} + +// SetSourceItemId gets a reference to the given string and assigns it to the SourceItemId field. +func (o *Thumbnail) SetSourceItemId(v string) { + o.SourceItemId = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *Thumbnail) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Thumbnail) GetUrlOk() (*string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *Thumbnail) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *Thumbnail) SetUrl(v string) { + o.Url = &v +} + +// GetWidth returns the Width field value if set, zero value otherwise. +func (o *Thumbnail) GetWidth() int32 { + if o == nil || IsNil(o.Width) { + var ret int32 + return ret + } + return *o.Width +} + +// GetWidthOk returns a tuple with the Width field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Thumbnail) GetWidthOk() (*int32, bool) { + if o == nil || IsNil(o.Width) { + return nil, false + } + return o.Width, true +} + +// HasWidth returns a boolean if a field has been set. +func (o *Thumbnail) HasWidth() bool { + if o != nil && !IsNil(o.Width) { + return true + } + + return false +} + +// SetWidth gets a reference to the given int32 and assigns it to the Width field. +func (o *Thumbnail) SetWidth(v int32) { + o.Width = &v +} + +func (o Thumbnail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Thumbnail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Content) { + toSerialize["content"] = o.Content + } + if !IsNil(o.Height) { + toSerialize["height"] = o.Height + } + if !IsNil(o.SourceItemId) { + toSerialize["sourceItemId"] = o.SourceItemId + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + if !IsNil(o.Width) { + toSerialize["width"] = o.Width + } + return toSerialize, nil +} + +type NullableThumbnail struct { + value *Thumbnail + isSet bool +} + +func (v NullableThumbnail) Get() *Thumbnail { + return v.value +} + +func (v *NullableThumbnail) Set(val *Thumbnail) { + v.value = val + v.isSet = true +} + +func (v NullableThumbnail) IsSet() bool { + return v.isSet +} + +func (v *NullableThumbnail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableThumbnail(val *Thumbnail) *NullableThumbnail { + return &NullableThumbnail{value: val, isSet: true} +} + +func (v NullableThumbnail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableThumbnail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/owncloud/libre-graph-api-go/model_thumbnail_set.go b/vendor/github.com/owncloud/libre-graph-api-go/model_thumbnail_set.go new file mode 100644 index 0000000000..96a10c8ef4 --- /dev/null +++ b/vendor/github.com/owncloud/libre-graph-api-go/model_thumbnail_set.go @@ -0,0 +1,269 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the ThumbnailSet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ThumbnailSet{} + +// ThumbnailSet The ThumbnailSet resource is a keyed collection of thumbnail resources. It's used to represent a set of thumbnails associated with a DriveItem. +type ThumbnailSet struct { + // The ID within the item. Read-only. + Id *string `json:"id,omitempty"` + Large *Thumbnail `json:"large,omitempty"` + Medium *Thumbnail `json:"medium,omitempty"` + Small *Thumbnail `json:"small,omitempty"` + Source *Thumbnail `json:"source,omitempty"` +} + +// NewThumbnailSet instantiates a new ThumbnailSet object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewThumbnailSet() *ThumbnailSet { + this := ThumbnailSet{} + return &this +} + +// NewThumbnailSetWithDefaults instantiates a new ThumbnailSet object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewThumbnailSetWithDefaults() *ThumbnailSet { + this := ThumbnailSet{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ThumbnailSet) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ThumbnailSet) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ThumbnailSet) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ThumbnailSet) SetId(v string) { + o.Id = &v +} + +// GetLarge returns the Large field value if set, zero value otherwise. +func (o *ThumbnailSet) GetLarge() Thumbnail { + if o == nil || IsNil(o.Large) { + var ret Thumbnail + return ret + } + return *o.Large +} + +// GetLargeOk returns a tuple with the Large field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ThumbnailSet) GetLargeOk() (*Thumbnail, bool) { + if o == nil || IsNil(o.Large) { + return nil, false + } + return o.Large, true +} + +// HasLarge returns a boolean if a field has been set. +func (o *ThumbnailSet) HasLarge() bool { + if o != nil && !IsNil(o.Large) { + return true + } + + return false +} + +// SetLarge gets a reference to the given Thumbnail and assigns it to the Large field. +func (o *ThumbnailSet) SetLarge(v Thumbnail) { + o.Large = &v +} + +// GetMedium returns the Medium field value if set, zero value otherwise. +func (o *ThumbnailSet) GetMedium() Thumbnail { + if o == nil || IsNil(o.Medium) { + var ret Thumbnail + return ret + } + return *o.Medium +} + +// GetMediumOk returns a tuple with the Medium field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ThumbnailSet) GetMediumOk() (*Thumbnail, bool) { + if o == nil || IsNil(o.Medium) { + return nil, false + } + return o.Medium, true +} + +// HasMedium returns a boolean if a field has been set. +func (o *ThumbnailSet) HasMedium() bool { + if o != nil && !IsNil(o.Medium) { + return true + } + + return false +} + +// SetMedium gets a reference to the given Thumbnail and assigns it to the Medium field. +func (o *ThumbnailSet) SetMedium(v Thumbnail) { + o.Medium = &v +} + +// GetSmall returns the Small field value if set, zero value otherwise. +func (o *ThumbnailSet) GetSmall() Thumbnail { + if o == nil || IsNil(o.Small) { + var ret Thumbnail + return ret + } + return *o.Small +} + +// GetSmallOk returns a tuple with the Small field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ThumbnailSet) GetSmallOk() (*Thumbnail, bool) { + if o == nil || IsNil(o.Small) { + return nil, false + } + return o.Small, true +} + +// HasSmall returns a boolean if a field has been set. +func (o *ThumbnailSet) HasSmall() bool { + if o != nil && !IsNil(o.Small) { + return true + } + + return false +} + +// SetSmall gets a reference to the given Thumbnail and assigns it to the Small field. +func (o *ThumbnailSet) SetSmall(v Thumbnail) { + o.Small = &v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *ThumbnailSet) GetSource() Thumbnail { + if o == nil || IsNil(o.Source) { + var ret Thumbnail + return ret + } + return *o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ThumbnailSet) GetSourceOk() (*Thumbnail, bool) { + if o == nil || IsNil(o.Source) { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *ThumbnailSet) HasSource() bool { + if o != nil && !IsNil(o.Source) { + return true + } + + return false +} + +// SetSource gets a reference to the given Thumbnail and assigns it to the Source field. +func (o *ThumbnailSet) SetSource(v Thumbnail) { + o.Source = &v +} + +func (o ThumbnailSet) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ThumbnailSet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Large) { + toSerialize["large"] = o.Large + } + if !IsNil(o.Medium) { + toSerialize["medium"] = o.Medium + } + if !IsNil(o.Small) { + toSerialize["small"] = o.Small + } + if !IsNil(o.Source) { + toSerialize["source"] = o.Source + } + return toSerialize, nil +} + +type NullableThumbnailSet struct { + value *ThumbnailSet + isSet bool +} + +func (v NullableThumbnailSet) Get() *ThumbnailSet { + return v.value +} + +func (v *NullableThumbnailSet) Set(val *ThumbnailSet) { + v.value = val + v.isSet = true +} + +func (v NullableThumbnailSet) IsSet() bool { + return v.isSet +} + +func (v *NullableThumbnailSet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableThumbnailSet(val *ThumbnailSet) *NullableThumbnailSet { + return &NullableThumbnailSet{value: val, isSet: true} +} + +func (v NullableThumbnailSet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableThumbnailSet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/owncloud/libre-graph-api-go/model_unified_role_permission.go b/vendor/github.com/owncloud/libre-graph-api-go/model_unified_role_permission.go index 0d0659db52..3ff8295a3b 100644 --- a/vendor/github.com/owncloud/libre-graph-api-go/model_unified_role_permission.go +++ b/vendor/github.com/owncloud/libre-graph-api-go/model_unified_role_permission.go @@ -21,7 +21,7 @@ var _ MappedNullable = &UnifiedRolePermission{} type UnifiedRolePermission struct { // Set of tasks that can be performed on a resource. Required. The following is the schema for resource actions: ``` {Namespace}/{Entity}/{PropertySet}/{Action} ``` For example: `libre.graph/applications/credentials/update` * *{Namespace}* - The services that exposes the task. For example, all tasks in libre graph use the namespace `libre.graph`. * *{Entity}* - The logical features or components exposed by the service in libre graph. For example, `applications`, `servicePrincipals`, or `groups`. * *{PropertySet}* - Optional. The specific properties or aspects of the entity for which access is being granted. For example, `libre.graph/applications/authentication/read` grants the ability to read the reply URL, logout URL, and implicit flow property on the **application** object in libre graph. The following are reserved names for common property sets: * `allProperties` - Designates all properties of the entity, including privileged properties. Examples include `libre.graph/applications/allProperties/read` and `libre.graph/applications/allProperties/update`. * `basic` - Designates common read properties but excludes privileged ones. For example, `libre.graph/applications/basic/update` includes the ability to update standard properties like display name. * `standard` - Designates common update properties but excludes privileged ones. For example, `libre.graph/applications/standard/read`. * *{Actions}* - The operations being granted. In most circumstances, permissions should be expressed in terms of CRUD operations or allTasks. Actions include: * `create` - The ability to create a new instance of the entity. * `read` - The ability to read a given property set (including allProperties). * `update` - The ability to update a given property set (including allProperties). * `delete` - The ability to delete a given entity. * `allTasks` - Represents all CRUD operations (create, read, update, and delete). Following the CS3 API we can represent the CS3 permissions by mapping them to driveItem properties or relations like this: | [CS3 ResourcePermission](https://cs3org.github.io/cs3apis/#cs3.storage.provider.v1beta1.ResourcePermissions) | action | comment | | ------------------------------------------------------------------------------------------------------------ | ------ | ------- | | `stat` | `libre.graph/driveItem/basic/read` | `basic` because it does not include versions or trashed items | | `get_quota` | `libre.graph/driveItem/quota/read` | read only the `quota` property | | `get_path` | `libre.graph/driveItem/path/read` | read only the `path` property | | `move` | `libre.graph/driveItem/path/update` | allows updating the `path` property of a CS3 resource | | `delete` | `libre.graph/driveItem/standard/delete` | `standard` because deleting is a common update operation | | `list_container` | `libre.graph/driveItem/children/read` | | | `create_container` | `libre.graph/driveItem/children/create` | | | `initiate_file_download` | `libre.graph/driveItem/content/read` | `content` is the property read when initiating a download | | `initiate_file_upload` | `libre.graph/driveItem/upload/create` | `uploads` are a separate property. postprocessing creates the `content` | | `add_grant` | `libre.graph/driveItem/permissions/create` | | | `list_grant` | `libre.graph/driveItem/permissions/read` | | | `update_grant` | `libre.graph/driveItem/permissions/update` | | | `remove_grant` | `libre.graph/driveItem/permissions/delete` | | | `deny_grant` | `libre.graph/driveItem/permissions/deny` | uses a non CRUD action `deny` | | `list_file_versions` | `libre.graph/driveItem/versions/read` | `versions` is a `driveItemVersion` collection | | `restore_file_version` | `libre.graph/driveItem/versions/update` | the only `update` action is restore | | `list_recycle` | `libre.graph/driveItem/deleted/read` | reading a driveItem `deleted` property implies listing | | `restore_recycle_item` | `libre.graph/driveItem/deleted/update` | the only `update` action is restore | | `purge_recycle` | `libre.graph/driveItem/deleted/delete` | allows purging deleted `driveItems` | Managing drives would be a different entity. A space manager role could be written as `libre.graph/drive/permission/allTasks`. AllowedResourceActions []string `json:"allowedResourceActions,omitempty"` - // Optional constraints that must be met for the permission to be effective. Not supported for custom roles. Conditions define constraints that must be met. For example, a requirement that the principal be an owner of the target resource. The following are the supported conditions: * Self: `@Subject.objectId == @Resource.objectId` * Owner: `@Subject.objectId Any_of @Resource.owners` * Grantee: `@Subject.objectId Any_of @Resource.grantee` - does not exist in MS Graph, but we use it to express permissions on shared resources. The following is an example of a role permission with a condition that the principal be the owner of the target resource. ```json \"rolePermissions\": [ { \"allowedResourceActions\": [ \"libre.graph/applications/basic/update\", \"libre.graph/applications/credentials/update\" ], \"condition\": \"@Subject.objectId Any_of @Resource.owners\" } ] ``` Conditions aren't supported for custom roles. + // Optional constraints that must be met for the permission to be effective. Not supported for custom roles. Conditions define constraints that must be met. For example, a requirement that target resource must have a certain property. The following are the supported conditions: * Drive: `exists @Resource.Drive` - The target resource must be a drive/space * Folder: `exists @Resource.Folder` - The target resource must be a folder * File: `exists @Resource.File` - The target resource must be a file The following is an example of a role permission with a condition that the target resource is a folder: ```json \"rolePermissions\": [ { \"allowedResourceActions\": [ \"libre.graph/applications/basic/update\", \"libre.graph/applications/credentials/update\" ], \"condition\": \"exists @Resource.File\" } ] ``` Conditions aren't supported for custom roles. Condition *string `json:"condition,omitempty"` } diff --git a/vendor/modules.txt b/vendor/modules.txt index 821d33148a..17e536ef68 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1605,7 +1605,7 @@ github.com/opentracing/opentracing-go/log # github.com/orcaman/concurrent-map v1.0.0 ## explicit github.com/orcaman/concurrent-map -# github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1 +# github.com/owncloud/libre-graph-api-go v1.0.5-0.20240425090020-dba6d1507c38 ## explicit; go 1.18 github.com/owncloud/libre-graph-api-go # github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c