github.com/cs3org/reva/v2@v2.27.7/pkg/events/groups.go (about) 1 // Copyright 2018-2022 CERN 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 // In applying this license, CERN does not waive the privileges and immunities 16 // granted to it by virtue of its status as an Intergovernmental Organization 17 // or submit itself to any jurisdiction. 18 19 package events 20 21 import ( 22 "encoding/json" 23 24 user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" 25 types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" 26 ) 27 28 // GroupCreated is emitted when a group was created 29 type GroupCreated struct { 30 Executant *user.UserId 31 GroupID string 32 Timestamp *types.Timestamp 33 } 34 35 // Unmarshal to fulfill umarshaller interface 36 func (GroupCreated) Unmarshal(v []byte) (interface{}, error) { 37 e := GroupCreated{} 38 err := json.Unmarshal(v, &e) 39 return e, err 40 } 41 42 // GroupDeleted is emitted when a group was deleted 43 type GroupDeleted struct { 44 Executant *user.UserId 45 GroupID string 46 Timestamp *types.Timestamp 47 } 48 49 // Unmarshal to fulfill umarshaller interface 50 func (GroupDeleted) Unmarshal(v []byte) (interface{}, error) { 51 e := GroupDeleted{} 52 err := json.Unmarshal(v, &e) 53 return e, err 54 } 55 56 // GroupMemberAdded is emitted when a user was added to a group 57 type GroupMemberAdded struct { 58 Executant *user.UserId 59 GroupID string 60 UserID string 61 Timestamp *types.Timestamp 62 } 63 64 // Unmarshal to fulfill umarshaller interface 65 func (GroupMemberAdded) Unmarshal(v []byte) (interface{}, error) { 66 e := GroupMemberAdded{} 67 err := json.Unmarshal(v, &e) 68 return e, err 69 } 70 71 // GroupMemberRemoved is emitted when a user was removed from a group 72 type GroupMemberRemoved struct { 73 Executant *user.UserId 74 GroupID string 75 UserID string 76 Timestamp *types.Timestamp 77 } 78 79 // Unmarshal to fulfill umarshaller interface 80 func (GroupMemberRemoved) Unmarshal(v []byte) (interface{}, error) { 81 e := GroupMemberRemoved{} 82 err := json.Unmarshal(v, &e) 83 return e, err 84 } 85 86 // GroupFeature represents a group feature 87 type GroupFeature struct { 88 Name string 89 Value string 90 Timestamp *types.Timestamp 91 } 92 93 // GroupFeatureChanged is emitted when a group feature was changed 94 type GroupFeatureChanged struct { 95 Executant *user.UserId 96 GroupID string 97 Features []GroupFeature 98 Timestamp *types.Timestamp 99 } 100 101 // Unmarshal to fulfill unmarshaller interface 102 func (GroupFeatureChanged) Unmarshal(v []byte) (interface{}, error) { 103 e := GroupFeatureChanged{} 104 err := json.Unmarshal(v, &e) 105 return e, err 106 }