chore: update libregraph api again

This commit is contained in:
Michael Barz
2023-11-28 11:07:31 +01:00
committed by Florian Schade
parent ce705bc6c8
commit eb6ec1311a
14 changed files with 508 additions and 232 deletions

2
go.mod
View File

@@ -68,7 +68,7 @@ require (
github.com/onsi/gomega v1.29.0
github.com/open-policy-agent/opa v0.51.0
github.com/orcaman/concurrent-map v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231116165004-6101db024810
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231128074031-fdcdb2371356
github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.9
github.com/prometheus/client_golang v1.17.0

4
go.sum
View File

@@ -1789,8 +1789,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.20231116165004-6101db024810 h1:a7ojKQIyMTyqgS+R2w4UAk88RqZ1eIEjoTMoyRV9zU0=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231116165004-6101db024810/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231128074031-fdcdb2371356 h1:JjjpyUlD5nKF79QMpQ7/KVq41hh6f49GJNuxCYgMIMA=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231128074031-fdcdb2371356/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs=
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=

View File

@@ -392,7 +392,7 @@ func (g Graph) Invite(w http.ResponseWriter, r *http.Request) {
}
if expiration := createShareResponse.GetShare().GetExpiration(); expiration != nil {
permission.ExpirationDateTime = libregraph.PtrTime(utils.TSToTime(expiration))
permission.SetExpirationDateTime(utils.TSToTime(expiration))
}
createShareSuccesses.Store(objectId, permission)

View File

@@ -797,7 +797,7 @@ func (g Graph) cs3PermissionsToLibreGraph(ctx context.Context, space *storagepro
}
if exp := permissionsExpirations[id]; exp != nil {
p.ExpirationDateTime = libregraph.PtrTime(time.Unix(int64(exp.GetSeconds()), int64(exp.GetNanos())))
p.SetExpirationDateTime(time.Unix(int64(exp.GetSeconds()), int64(exp.GetNanos())))
}
// we need to map the permissions to the roles

View File

@@ -2,6 +2,8 @@ package svc
import (
"context"
"encoding/json"
"io"
"net/http"
"net/url"
"path"
@@ -28,7 +30,8 @@ func (g Graph) CreateLink(w http.ResponseWriter, r *http.Request) {
}
var createLink libregraph.DriveItemCreateLink
if err := StrictJSONUnmarshal(r.Body, &createLink); err != nil {
body, err := io.ReadAll(r.Body)
if err := json.Unmarshal(body, &createLink); err != nil {
logger.Error().Err(err).Interface("body", r.Body).Msg("could not create link: invalid body schema definition")
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "invalid body schema definition")
return
@@ -87,8 +90,9 @@ func (g Graph) createLink(ctx context.Context, driveItemID *providerv1beta1.Reso
Password: createLink.GetPassword(),
},
}
if createLink.ExpirationDateTime != nil {
req.GetGrant().Expiration = utils.TimeToTS(createLink.GetExpirationDateTime())
expirationDate, isSet := createLink.GetExpirationDateTimeOk()
if isSet {
req.GetGrant().Expiration = utils.TimeToTS(*expirationDate)
}
// set displayname and password protected as arbitrary metadata

View File

@@ -89,6 +89,7 @@ Class | Method | HTTP request | Description
*DrivesPermissionsApi* | [**GetPermission**](docs/DrivesPermissionsApi.md#getpermission) | **Get** /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Get sharing permission for a file or folder
*DrivesPermissionsApi* | [**Invite**](docs/DrivesPermissionsApi.md#invite) | **Post** /v1beta1/drives/{drive-id}/items/{item-id}/invite | Send a sharing invitation
*DrivesPermissionsApi* | [**ListPermissions**](docs/DrivesPermissionsApi.md#listpermissions) | **Get** /v1beta1/drives/{drive-id}/items/{item-id}/permissions | List the effective sharing permissions on a driveItem.
*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* | [**GetRoot**](docs/DrivesRootApi.md#getroot) | **Get** /v1.0/drives/{drive-id}/root | Get root from arbitrary space
*EducationClassApi* | [**AddUserToClass**](docs/EducationClassApi.md#addusertoclass) | **Post** /v1.0/education/classes/{class-id}/members/$ref | Assign a user to a class
@@ -169,9 +170,9 @@ Class | Method | HTTP request | Description
- [CollectionOfDrives1](docs/CollectionOfDrives1.md)
- [CollectionOfEducationClass](docs/CollectionOfEducationClass.md)
- [CollectionOfEducationUser](docs/CollectionOfEducationUser.md)
- [CollectionOfEducationUser1](docs/CollectionOfEducationUser1.md)
- [CollectionOfGroup](docs/CollectionOfGroup.md)
- [CollectionOfPermissions](docs/CollectionOfPermissions.md)
- [CollectionOfPermissionsWithAllowedValues](docs/CollectionOfPermissionsWithAllowedValues.md)
- [CollectionOfSchools](docs/CollectionOfSchools.md)
- [CollectionOfTags](docs/CollectionOfTags.md)
- [CollectionOfUser](docs/CollectionOfUser.md)
@@ -215,6 +216,7 @@ Class | Method | HTTP request | Description
- [SharePointIdentitySet](docs/SharePointIdentitySet.md)
- [Shared](docs/Shared.md)
- [SharingLink](docs/SharingLink.md)
- [SharingLinkPassword](docs/SharingLinkPassword.md)
- [SharingLinkType](docs/SharingLinkType.md)
- [SpecialFolder](docs/SpecialFolder.md)
- [TagAssignment](docs/TagAssignment.md)

View File

@@ -406,7 +406,7 @@ func (r ApiInviteRequest) DriveItemInvite(driveItemInvite DriveItemInvite) ApiIn
return r
}
func (r ApiInviteRequest) Execute() (*Permission, *http.Response, error) {
func (r ApiInviteRequest) Execute() (*CollectionOfPermissions, *http.Response, error) {
return r.ApiService.InviteExecute(r)
}
@@ -437,13 +437,13 @@ func (a *DrivesPermissionsApiService) Invite(ctx context.Context, driveId string
}
// Execute executes the request
// @return Permission
func (a *DrivesPermissionsApiService) InviteExecute(r ApiInviteRequest) (*Permission, *http.Response, error) {
// @return CollectionOfPermissions
func (a *DrivesPermissionsApiService) InviteExecute(r ApiInviteRequest) (*CollectionOfPermissions, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *Permission
localVarReturnValue *CollectionOfPermissions
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesPermissionsApiService.Invite")
@@ -541,7 +541,7 @@ type ApiListPermissionsRequest struct {
itemId string
}
func (r ApiListPermissionsRequest) Execute() (*CollectionOfPermissions, *http.Response, error) {
func (r ApiListPermissionsRequest) Execute() (*CollectionOfPermissionsWithAllowedValues, *http.Response, error) {
return r.ApiService.ListPermissionsExecute(r)
}
@@ -574,13 +574,13 @@ func (a *DrivesPermissionsApiService) ListPermissions(ctx context.Context, drive
}
// Execute executes the request
// @return CollectionOfPermissions
func (a *DrivesPermissionsApiService) ListPermissionsExecute(r ApiListPermissionsRequest) (*CollectionOfPermissions, *http.Response, error) {
// @return CollectionOfPermissionsWithAllowedValues
func (a *DrivesPermissionsApiService) ListPermissionsExecute(r ApiListPermissionsRequest) (*CollectionOfPermissionsWithAllowedValues, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *CollectionOfPermissions
localVarReturnValue *CollectionOfPermissionsWithAllowedValues
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesPermissionsApiService.ListPermissions")
@@ -658,6 +658,140 @@ func (a *DrivesPermissionsApiService) ListPermissionsExecute(r ApiListPermission
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiSetPermissionPasswordRequest struct {
ctx context.Context
ApiService *DrivesPermissionsApiService
driveId string
itemId string
permId string
sharingLinkPassword *SharingLinkPassword
}
// New password value
func (r ApiSetPermissionPasswordRequest) SharingLinkPassword(sharingLinkPassword SharingLinkPassword) ApiSetPermissionPasswordRequest {
r.sharingLinkPassword = &sharingLinkPassword
return r
}
func (r ApiSetPermissionPasswordRequest) Execute() (*Permission, *http.Response, error) {
return r.ApiService.SetPermissionPasswordExecute(r)
}
/*
SetPermissionPassword Set sharing link password
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 itemId key: id of item
@param permId key: id of permission
@return ApiSetPermissionPasswordRequest
*/
func (a *DrivesPermissionsApiService) SetPermissionPassword(ctx context.Context, driveId string, itemId string, permId string) ApiSetPermissionPasswordRequest {
return ApiSetPermissionPasswordRequest{
ApiService: a,
ctx: ctx,
driveId: driveId,
itemId: itemId,
permId: permId,
}
}
// Execute executes the request
// @return Permission
func (a *DrivesPermissionsApiService) SetPermissionPasswordExecute(r ApiSetPermissionPasswordRequest) (*Permission, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *Permission
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DrivesPermissionsApiService.SetPermissionPassword")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id}/setPassword"
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)
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 ApiUpdatePermissionRequest struct {
ctx context.Context
ApiService *DrivesPermissionsApiService

View File

@@ -887,7 +887,7 @@ type ApiListSchoolUsersRequest struct {
schoolId string
}
func (r ApiListSchoolUsersRequest) Execute() (*CollectionOfEducationUser1, *http.Response, error) {
func (r ApiListSchoolUsersRequest) Execute() (*CollectionOfEducationUser, *http.Response, error) {
return r.ApiService.ListSchoolUsersExecute(r)
}
@@ -907,13 +907,13 @@ func (a *EducationSchoolApiService) ListSchoolUsers(ctx context.Context, schoolI
}
// Execute executes the request
// @return CollectionOfEducationUser1
func (a *EducationSchoolApiService) ListSchoolUsersExecute(r ApiListSchoolUsersRequest) (*CollectionOfEducationUser1, *http.Response, error) {
// @return CollectionOfEducationUser
func (a *EducationSchoolApiService) ListSchoolUsersExecute(r ApiListSchoolUsersRequest) (*CollectionOfEducationUser, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *CollectionOfEducationUser1
localVarReturnValue *CollectionOfEducationUser
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EducationSchoolApiService.ListSchoolUsers")

View File

@@ -1,124 +0,0 @@
/*
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 CollectionOfEducationUser1 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CollectionOfEducationUser1{}
// CollectionOfEducationUser1 struct for CollectionOfEducationUser1
type CollectionOfEducationUser1 struct {
Value []EducationClass `json:"value,omitempty"`
}
// NewCollectionOfEducationUser1 instantiates a new CollectionOfEducationUser1 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 NewCollectionOfEducationUser1() *CollectionOfEducationUser1 {
this := CollectionOfEducationUser1{}
return &this
}
// NewCollectionOfEducationUser1WithDefaults instantiates a new CollectionOfEducationUser1 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 NewCollectionOfEducationUser1WithDefaults() *CollectionOfEducationUser1 {
this := CollectionOfEducationUser1{}
return &this
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *CollectionOfEducationUser1) GetValue() []EducationClass {
if o == nil || IsNil(o.Value) {
var ret []EducationClass
return ret
}
return o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfEducationUser1) GetValueOk() ([]EducationClass, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *CollectionOfEducationUser1) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given []EducationClass and assigns it to the Value field.
func (o *CollectionOfEducationUser1) SetValue(v []EducationClass) {
o.Value = v
}
func (o CollectionOfEducationUser1) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CollectionOfEducationUser1) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
return toSerialize, nil
}
type NullableCollectionOfEducationUser1 struct {
value *CollectionOfEducationUser1
isSet bool
}
func (v NullableCollectionOfEducationUser1) Get() *CollectionOfEducationUser1 {
return v.value
}
func (v *NullableCollectionOfEducationUser1) Set(val *CollectionOfEducationUser1) {
v.value = val
v.isSet = true
}
func (v NullableCollectionOfEducationUser1) IsSet() bool {
return v.isSet
}
func (v *NullableCollectionOfEducationUser1) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCollectionOfEducationUser1(val *CollectionOfEducationUser1) *NullableCollectionOfEducationUser1 {
return &NullableCollectionOfEducationUser1{value: val, isSet: true}
}
func (v NullableCollectionOfEducationUser1) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCollectionOfEducationUser1) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@@ -19,11 +19,7 @@ var _ MappedNullable = &CollectionOfPermissions{}
// CollectionOfPermissions struct for CollectionOfPermissions
type CollectionOfPermissions struct {
// A list of role definitions that can be chosen for the resource.
LibreGraphPermissionsRolesAllowedValues []UnifiedRoleDefinition `json:"@libre.graph.permissions.roles.allowedValues,omitempty"`
// A list of actions that can be chosen for a custom role. 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` |
LibreGraphPermissionsActionsAllowedValues []string `json:"@libre.graph.permissions.actions.allowedValues,omitempty"`
Value []Permission `json:"value,omitempty"`
Value []Permission `json:"value,omitempty"`
}
// NewCollectionOfPermissions instantiates a new CollectionOfPermissions object
@@ -43,70 +39,6 @@ func NewCollectionOfPermissionsWithDefaults() *CollectionOfPermissions {
return &this
}
// GetLibreGraphPermissionsRolesAllowedValues returns the LibreGraphPermissionsRolesAllowedValues field value if set, zero value otherwise.
func (o *CollectionOfPermissions) GetLibreGraphPermissionsRolesAllowedValues() []UnifiedRoleDefinition {
if o == nil || IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
var ret []UnifiedRoleDefinition
return ret
}
return o.LibreGraphPermissionsRolesAllowedValues
}
// GetLibreGraphPermissionsRolesAllowedValuesOk returns a tuple with the LibreGraphPermissionsRolesAllowedValues field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissions) GetLibreGraphPermissionsRolesAllowedValuesOk() ([]UnifiedRoleDefinition, bool) {
if o == nil || IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
return nil, false
}
return o.LibreGraphPermissionsRolesAllowedValues, true
}
// HasLibreGraphPermissionsRolesAllowedValues returns a boolean if a field has been set.
func (o *CollectionOfPermissions) HasLibreGraphPermissionsRolesAllowedValues() bool {
if o != nil && !IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
return true
}
return false
}
// SetLibreGraphPermissionsRolesAllowedValues gets a reference to the given []UnifiedRoleDefinition and assigns it to the LibreGraphPermissionsRolesAllowedValues field.
func (o *CollectionOfPermissions) SetLibreGraphPermissionsRolesAllowedValues(v []UnifiedRoleDefinition) {
o.LibreGraphPermissionsRolesAllowedValues = v
}
// GetLibreGraphPermissionsActionsAllowedValues returns the LibreGraphPermissionsActionsAllowedValues field value if set, zero value otherwise.
func (o *CollectionOfPermissions) GetLibreGraphPermissionsActionsAllowedValues() []string {
if o == nil || IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
var ret []string
return ret
}
return o.LibreGraphPermissionsActionsAllowedValues
}
// GetLibreGraphPermissionsActionsAllowedValuesOk returns a tuple with the LibreGraphPermissionsActionsAllowedValues field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissions) GetLibreGraphPermissionsActionsAllowedValuesOk() ([]string, bool) {
if o == nil || IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
return nil, false
}
return o.LibreGraphPermissionsActionsAllowedValues, true
}
// HasLibreGraphPermissionsActionsAllowedValues returns a boolean if a field has been set.
func (o *CollectionOfPermissions) HasLibreGraphPermissionsActionsAllowedValues() bool {
if o != nil && !IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
return true
}
return false
}
// SetLibreGraphPermissionsActionsAllowedValues gets a reference to the given []string and assigns it to the LibreGraphPermissionsActionsAllowedValues field.
func (o *CollectionOfPermissions) SetLibreGraphPermissionsActionsAllowedValues(v []string) {
o.LibreGraphPermissionsActionsAllowedValues = v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *CollectionOfPermissions) GetValue() []Permission {
if o == nil || IsNil(o.Value) {
@@ -149,12 +81,6 @@ func (o CollectionOfPermissions) MarshalJSON() ([]byte, error) {
func (o CollectionOfPermissions) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
toSerialize["@libre.graph.permissions.roles.allowedValues"] = o.LibreGraphPermissionsRolesAllowedValues
}
if !IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
toSerialize["@libre.graph.permissions.actions.allowedValues"] = o.LibreGraphPermissionsActionsAllowedValues
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}

View File

@@ -0,0 +1,198 @@
/*
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 CollectionOfPermissionsWithAllowedValues type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CollectionOfPermissionsWithAllowedValues{}
// CollectionOfPermissionsWithAllowedValues struct for CollectionOfPermissionsWithAllowedValues
type CollectionOfPermissionsWithAllowedValues struct {
// A list of role definitions that can be chosen for the resource.
LibreGraphPermissionsRolesAllowedValues []UnifiedRoleDefinition `json:"@libre.graph.permissions.roles.allowedValues,omitempty"`
// A list of actions that can be chosen for a custom role. 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` |
LibreGraphPermissionsActionsAllowedValues []string `json:"@libre.graph.permissions.actions.allowedValues,omitempty"`
Value []Permission `json:"value,omitempty"`
}
// NewCollectionOfPermissionsWithAllowedValues instantiates a new CollectionOfPermissionsWithAllowedValues 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 NewCollectionOfPermissionsWithAllowedValues() *CollectionOfPermissionsWithAllowedValues {
this := CollectionOfPermissionsWithAllowedValues{}
return &this
}
// NewCollectionOfPermissionsWithAllowedValuesWithDefaults instantiates a new CollectionOfPermissionsWithAllowedValues 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 NewCollectionOfPermissionsWithAllowedValuesWithDefaults() *CollectionOfPermissionsWithAllowedValues {
this := CollectionOfPermissionsWithAllowedValues{}
return &this
}
// GetLibreGraphPermissionsRolesAllowedValues returns the LibreGraphPermissionsRolesAllowedValues field value if set, zero value otherwise.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsRolesAllowedValues() []UnifiedRoleDefinition {
if o == nil || IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
var ret []UnifiedRoleDefinition
return ret
}
return o.LibreGraphPermissionsRolesAllowedValues
}
// GetLibreGraphPermissionsRolesAllowedValuesOk returns a tuple with the LibreGraphPermissionsRolesAllowedValues field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsRolesAllowedValuesOk() ([]UnifiedRoleDefinition, bool) {
if o == nil || IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
return nil, false
}
return o.LibreGraphPermissionsRolesAllowedValues, true
}
// HasLibreGraphPermissionsRolesAllowedValues returns a boolean if a field has been set.
func (o *CollectionOfPermissionsWithAllowedValues) HasLibreGraphPermissionsRolesAllowedValues() bool {
if o != nil && !IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
return true
}
return false
}
// SetLibreGraphPermissionsRolesAllowedValues gets a reference to the given []UnifiedRoleDefinition and assigns it to the LibreGraphPermissionsRolesAllowedValues field.
func (o *CollectionOfPermissionsWithAllowedValues) SetLibreGraphPermissionsRolesAllowedValues(v []UnifiedRoleDefinition) {
o.LibreGraphPermissionsRolesAllowedValues = v
}
// GetLibreGraphPermissionsActionsAllowedValues returns the LibreGraphPermissionsActionsAllowedValues field value if set, zero value otherwise.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsActionsAllowedValues() []string {
if o == nil || IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
var ret []string
return ret
}
return o.LibreGraphPermissionsActionsAllowedValues
}
// GetLibreGraphPermissionsActionsAllowedValuesOk returns a tuple with the LibreGraphPermissionsActionsAllowedValues field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsActionsAllowedValuesOk() ([]string, bool) {
if o == nil || IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
return nil, false
}
return o.LibreGraphPermissionsActionsAllowedValues, true
}
// HasLibreGraphPermissionsActionsAllowedValues returns a boolean if a field has been set.
func (o *CollectionOfPermissionsWithAllowedValues) HasLibreGraphPermissionsActionsAllowedValues() bool {
if o != nil && !IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
return true
}
return false
}
// SetLibreGraphPermissionsActionsAllowedValues gets a reference to the given []string and assigns it to the LibreGraphPermissionsActionsAllowedValues field.
func (o *CollectionOfPermissionsWithAllowedValues) SetLibreGraphPermissionsActionsAllowedValues(v []string) {
o.LibreGraphPermissionsActionsAllowedValues = v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *CollectionOfPermissionsWithAllowedValues) GetValue() []Permission {
if o == nil || IsNil(o.Value) {
var ret []Permission
return ret
}
return o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissionsWithAllowedValues) GetValueOk() ([]Permission, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *CollectionOfPermissionsWithAllowedValues) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given []Permission and assigns it to the Value field.
func (o *CollectionOfPermissionsWithAllowedValues) SetValue(v []Permission) {
o.Value = v
}
func (o CollectionOfPermissionsWithAllowedValues) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CollectionOfPermissionsWithAllowedValues) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
toSerialize["@libre.graph.permissions.roles.allowedValues"] = o.LibreGraphPermissionsRolesAllowedValues
}
if !IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
toSerialize["@libre.graph.permissions.actions.allowedValues"] = o.LibreGraphPermissionsActionsAllowedValues
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
return toSerialize, nil
}
type NullableCollectionOfPermissionsWithAllowedValues struct {
value *CollectionOfPermissionsWithAllowedValues
isSet bool
}
func (v NullableCollectionOfPermissionsWithAllowedValues) Get() *CollectionOfPermissionsWithAllowedValues {
return v.value
}
func (v *NullableCollectionOfPermissionsWithAllowedValues) Set(val *CollectionOfPermissionsWithAllowedValues) {
v.value = val
v.isSet = true
}
func (v NullableCollectionOfPermissionsWithAllowedValues) IsSet() bool {
return v.isSet
}
func (v *NullableCollectionOfPermissionsWithAllowedValues) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCollectionOfPermissionsWithAllowedValues(val *CollectionOfPermissionsWithAllowedValues) *NullableCollectionOfPermissionsWithAllowedValues {
return &NullableCollectionOfPermissionsWithAllowedValues{value: val, isSet: true}
}
func (v NullableCollectionOfPermissionsWithAllowedValues) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCollectionOfPermissionsWithAllowedValues) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@@ -25,7 +25,7 @@ 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 *time.Time `json:"expirationDateTime,omitempty"`
ExpirationDateTime NullableTime `json:"expirationDateTime,omitempty"`
GrantedToV2 *SharePointIdentitySet `json:"grantedToV2,omitempty"`
Link *SharingLink `json:"link,omitempty"`
Roles []string `json:"roles,omitempty"`
@@ -119,36 +119,47 @@ func (o *Permission) SetHasPassword(v bool) {
o.HasPassword = &v
}
// GetExpirationDateTime returns the ExpirationDateTime field value if set, zero value otherwise.
// GetExpirationDateTime returns the ExpirationDateTime field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Permission) GetExpirationDateTime() time.Time {
if o == nil || IsNil(o.ExpirationDateTime) {
if o == nil || IsNil(o.ExpirationDateTime.Get()) {
var ret time.Time
return ret
}
return *o.ExpirationDateTime
return *o.ExpirationDateTime.Get()
}
// GetExpirationDateTimeOk returns a tuple with the ExpirationDateTime 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) GetExpirationDateTimeOk() (*time.Time, bool) {
if o == nil || IsNil(o.ExpirationDateTime) {
if o == nil {
return nil, false
}
return o.ExpirationDateTime, true
return o.ExpirationDateTime.Get(), o.ExpirationDateTime.IsSet()
}
// HasExpirationDateTime returns a boolean if a field has been set.
func (o *Permission) HasExpirationDateTime() bool {
if o != nil && !IsNil(o.ExpirationDateTime) {
if o != nil && o.ExpirationDateTime.IsSet() {
return true
}
return false
}
// SetExpirationDateTime gets a reference to the given time.Time and assigns it to the ExpirationDateTime field.
// SetExpirationDateTime gets a reference to the given NullableTime and assigns it to the ExpirationDateTime field.
func (o *Permission) SetExpirationDateTime(v time.Time) {
o.ExpirationDateTime = &v
o.ExpirationDateTime.Set(&v)
}
// SetExpirationDateTimeNil sets the value for ExpirationDateTime to be an explicit nil
func (o *Permission) SetExpirationDateTimeNil() {
o.ExpirationDateTime.Set(nil)
}
// UnsetExpirationDateTime ensures that no value is present for ExpirationDateTime, not even an explicit nil
func (o *Permission) UnsetExpirationDateTime() {
o.ExpirationDateTime.Unset()
}
// GetGrantedToV2 returns the GrantedToV2 field value if set, zero value otherwise.
@@ -362,8 +373,8 @@ func (o Permission) ToMap() (map[string]interface{}, error) {
if !IsNil(o.HasPassword) {
toSerialize["hasPassword"] = o.HasPassword
}
if !IsNil(o.ExpirationDateTime) {
toSerialize["expirationDateTime"] = o.ExpirationDateTime
if o.ExpirationDateTime.IsSet() {
toSerialize["expirationDateTime"] = o.ExpirationDateTime.Get()
}
if !IsNil(o.GrantedToV2) {
toSerialize["grantedToV2"] = o.GrantedToV2

View File

@@ -0,0 +1,125 @@
/*
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 SharingLinkPassword type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SharingLinkPassword{}
// SharingLinkPassword The sharing link password which should be set.
type SharingLinkPassword struct {
// Password. It may require a password policy.
Password *string `json:"password,omitempty"`
}
// NewSharingLinkPassword instantiates a new SharingLinkPassword 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 NewSharingLinkPassword() *SharingLinkPassword {
this := SharingLinkPassword{}
return &this
}
// NewSharingLinkPasswordWithDefaults instantiates a new SharingLinkPassword 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 NewSharingLinkPasswordWithDefaults() *SharingLinkPassword {
this := SharingLinkPassword{}
return &this
}
// GetPassword returns the Password field value if set, zero value otherwise.
func (o *SharingLinkPassword) GetPassword() string {
if o == nil || IsNil(o.Password) {
var ret string
return ret
}
return *o.Password
}
// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SharingLinkPassword) GetPasswordOk() (*string, bool) {
if o == nil || IsNil(o.Password) {
return nil, false
}
return o.Password, true
}
// HasPassword returns a boolean if a field has been set.
func (o *SharingLinkPassword) HasPassword() bool {
if o != nil && !IsNil(o.Password) {
return true
}
return false
}
// SetPassword gets a reference to the given string and assigns it to the Password field.
func (o *SharingLinkPassword) SetPassword(v string) {
o.Password = &v
}
func (o SharingLinkPassword) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SharingLinkPassword) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Password) {
toSerialize["password"] = o.Password
}
return toSerialize, nil
}
type NullableSharingLinkPassword struct {
value *SharingLinkPassword
isSet bool
}
func (v NullableSharingLinkPassword) Get() *SharingLinkPassword {
return v.value
}
func (v *NullableSharingLinkPassword) Set(val *SharingLinkPassword) {
v.value = val
v.isSet = true
}
func (v NullableSharingLinkPassword) IsSet() bool {
return v.isSet
}
func (v *NullableSharingLinkPassword) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSharingLinkPassword(val *SharingLinkPassword) *NullableSharingLinkPassword {
return &NullableSharingLinkPassword{value: val, isSet: true}
}
func (v NullableSharingLinkPassword) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSharingLinkPassword) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

2
vendor/modules.txt vendored
View File

@@ -1560,7 +1560,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.20231116165004-6101db024810
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20231128074031-fdcdb2371356
## explicit; go 1.18
github.com/owncloud/libre-graph-api-go
# github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c