diff --git a/go.mod b/go.mod index f6b1355853..bba1ae3396 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/onsi/gomega v1.39.1 github.com/open-policy-agent/opa v1.14.1 github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 - github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260204102724-10bcda1b3068 + github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310095109-64a5650c97e2 github.com/opencloud-eu/reva/v2 v2.42.5 github.com/opensearch-project/opensearch-go/v4 v4.6.0 github.com/orcaman/concurrent-map v1.0.0 diff --git a/go.sum b/go.sum index d9f2de5d53..10ab26b670 100644 --- a/go.sum +++ b/go.sum @@ -963,8 +963,8 @@ github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 h1:W1ms+l github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89/go.mod h1:vigJkNss1N2QEceCuNw/ullDehncuJNFB6mEnzfq9UI= github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9 h1:dIftlX03Bzfbujhp9B54FbgER0VBDWJi/w8RBxJlzxU= github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9/go.mod h1:JWyDC6H+5oZRdUJUgKuaye+8Ph5hEs6HVzVoPKzWSGI= -github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260204102724-10bcda1b3068 h1:i09YEVYbiUBMhxyak93REn/ZJOTRhAN4I3PXp2nCXgU= -github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260204102724-10bcda1b3068/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= +github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310095109-64a5650c97e2 h1:DgeiMlGRDiUS5eitDRznhXH+5hicM9pG/ufOD6+9TD0= +github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310095109-64a5650c97e2/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= github.com/opencloud-eu/reva/v2 v2.42.5 h1:Srhk8++3zJe3KA1u2Vqh4VbmljbblF75DR7t4HW0Kxw= github.com/opencloud-eu/reva/v2 v2.42.5/go.mod h1:U3UaHyAQcutavXyLaLE3UVY5n6t2pRAN9uv09n69lwI= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= diff --git a/services/invitations/pkg/command/server.go b/services/invitations/pkg/command/server.go index 23cf31690e..cd7f18987b 100644 --- a/services/invitations/pkg/command/server.go +++ b/services/invitations/pkg/command/server.go @@ -16,6 +16,8 @@ import ( "github.com/opencloud-eu/opencloud/services/invitations/pkg/server/debug" "github.com/opencloud-eu/opencloud/services/invitations/pkg/server/http" "github.com/opencloud-eu/opencloud/services/invitations/pkg/service/v0" + "github.com/opencloud-eu/reva/v2/pkg/store" + microstore "go-micro.dev/v4/store" "github.com/spf13/cobra" ) @@ -45,12 +47,20 @@ func Server(cfg *config.Config) *cobra.Command { metrics := metrics.New(metrics.Logger(logger)) metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1) + invitiationPersistanceStore := store.Create( + store.Store(cfg.Persistance.Store), + microstore.Nodes(cfg.Persistance.Nodes...), + microstore.Database(cfg.Persistance.Database), + store.Authentication(cfg.Persistance.AuthUsername, cfg.Persistance.AuthPassword), + ) + gr := runner.NewGroup() { svc, err := service.New( service.Logger(logger), service.Config(cfg), + service.WithPersistance(&invitiationPersistanceStore), // service.WithRelationProviders(relationProviders), ) if err != nil { diff --git a/services/invitations/pkg/config/config.go b/services/invitations/pkg/config/config.go index 6cf9843d59..4e909449f2 100644 --- a/services/invitations/pkg/config/config.go +++ b/services/invitations/pkg/config/config.go @@ -2,6 +2,7 @@ package config import ( "context" + "time" "github.com/opencloud-eu/opencloud/pkg/shared" ) @@ -17,10 +18,16 @@ type Config struct { HTTP HTTP `yaml:"http"` + UseBackEndForInvitations bool `yaml:"use_backend_for_invitations" env:"INVITATIONS_USE_BACKEND_FOR_INVITATIONS" desc:"Use the backend for invitations." introductionVersion:"1.0.0"` + Keycloak Keycloak `yaml:"keycloak"` TokenManager *TokenManager `yaml:"token_manager"` + Invitation Invitation `yaml:"invitation"` + Context context.Context `yaml:"-"` + + Persistance Persistance `yaml:"persistance"` } // Keycloak configuration @@ -32,3 +39,16 @@ type Keycloak struct { UserRealm string `yaml:"user_realm" env:"OC_KEYCLOAK_USER_REALM;INVITATIONS_KEYCLOAK_USER_REALM" desc:"The realm users are defined." introductionVersion:"1.0.0"` InsecureSkipVerify bool `yaml:"insecure_skip_verify" env:"OC_KEYCLOAK_INSECURE_SKIP_VERIFY;INVITATIONS_KEYCLOAK_INSECURE_SKIP_VERIFY" desc:"Disable TLS certificate validation for Keycloak connections. Do not set this in production environments." introductionVersion:"1.0.0"` } + +type Invitation struct { + MaxTTL time.Duration `yaml:"max_ttl" env:"INVITATIONS_MAX_TTL" desc:"The maximum time to live for an invitation. (defaults to 30 days)" introductionVersion:"%%NEXT%%"` +} + +type Persistance struct { + Store string `yaml:"store" env:"INVITATIONS_PERSISTANCE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'nats-js-kv'. See the text description for details." introductionVersion:"%%NEXT%%""` + Nodes []string `yaml:"addresses" env:"INVITATIONS_PERSISTANCE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"%%NEXT%%"` + Database string `yaml:"database" env:"INVITATIONS_PERSISTANCE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"%%NEXT%%"` + Table string `yaml:"table" env:"INVITATIONS_PERSISTANCE_TABLE" desc:"The database table the store should use." introductionVersion:"%%NEXT%%"` + AuthUsername string `yaml:"username" env:"INVITATIONS_PERSISTANCE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"%%NEXT%%"` + AuthPassword string `yaml:"password" env:"INVITATIONS_PERSISTANCE_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"%%NEXT%%"` +} diff --git a/services/invitations/pkg/config/defaults/defaultconfig.go b/services/invitations/pkg/config/defaults/defaultconfig.go index efa629e25c..809d0c10be 100644 --- a/services/invitations/pkg/config/defaults/defaultconfig.go +++ b/services/invitations/pkg/config/defaults/defaultconfig.go @@ -2,6 +2,7 @@ package defaults import ( "strings" + "time" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config" ) @@ -32,6 +33,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "invitations", }, + UseBackEndForInvitations: false, Keycloak: config.Keycloak{ BasePath: "", ClientID: "", @@ -39,6 +41,17 @@ func DefaultConfig() *config.Config { ClientRealm: "", UserRealm: "", }, + Invitation: config.Invitation{ + MaxTTL: 30 * 24 * time.Hour, + }, + Persistance: config.Persistance{ + Store: "memory", + Nodes: []string{}, + Database: "", + Table: "", + AuthUsername: "", + AuthPassword: "", + }, } } diff --git a/services/invitations/pkg/server/http/server.go b/services/invitations/pkg/server/http/server.go index cc60b27747..acd6f4a748 100644 --- a/services/invitations/pkg/server/http/server.go +++ b/services/invitations/pkg/server/http/server.go @@ -71,7 +71,9 @@ func Server(opts ...Option) (ohttp.Service, error) { )) mux.Route(options.Config.HTTP.Root, func(r chi.Router) { - r.Post("/invitations", InvitationHandler(service)) + r.Post("/invitations", InvitationPostHandler(service)) + r.Get("/invitations", InvitationListGetHandler(service)) + r.Get("/invitations/{id}", InvitationGetHandler(service)) }) err = micro.RegisterHandler(svc.Server(), mux) @@ -83,7 +85,7 @@ func Server(opts ...Option) (ohttp.Service, error) { return svc, nil } -func InvitationHandler(service svc.Service) func(w http.ResponseWriter, r *http.Request) { +func InvitationPostHandler(service svc.Service) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -105,3 +107,41 @@ func InvitationHandler(service svc.Service) func(w http.ResponseWriter, r *http. render.JSON(w, r, res) } } + +func InvitationGetHandler(service svc.Service) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + id := chi.URLParam(r, "id") + if id == "" { + errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "missing invitation ID") + return + } + + res, err := service.Get(ctx, id) + if err != nil { + render.Status(r, http.StatusInternalServerError) + render.PlainText(w, r, err.Error()) + return + } + + render.Status(r, http.StatusOK) + render.JSON(w, r, res) + } +} + +func InvitationListGetHandler(service svc.Service) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + res, err := service.List(ctx) + if err != nil { + render.Status(r, http.StatusInternalServerError) + render.PlainText(w, r, err.Error()) + return + } + + render.Status(r, http.StatusOK) + render.JSON(w, r, res) + } +} diff --git a/services/invitations/pkg/service/v0/errors.go b/services/invitations/pkg/service/v0/errors.go index 05aece5585..8fb76dc3df 100644 --- a/services/invitations/pkg/service/v0/errors.go +++ b/services/invitations/pkg/service/v0/errors.go @@ -7,4 +7,8 @@ var ( ErrBadRequest = errors.New("bad request") ErrMissingEmail = errors.New("missing email address") ErrBackend = errors.New("backend error") + + ErrSerialization = errors.New("serialization error") + ErrPersistence = errors.New("persistence error") + ErrUnauthorized = errors.New("unauthorized") ) diff --git a/services/invitations/pkg/service/v0/instrument.go b/services/invitations/pkg/service/v0/instrument.go index c748f05cec..080da4b611 100644 --- a/services/invitations/pkg/service/v0/instrument.go +++ b/services/invitations/pkg/service/v0/instrument.go @@ -21,6 +21,36 @@ type instrument struct { metrics *metrics.Metrics } +func (i instrument) List(ctx context.Context, userId string) ([]*invitations.Invitation, error) { + timer := prometheus.NewTimer(prometheus.ObserverFunc(func(v float64) { + us := v * 1000000 + + i.metrics.Latency.WithLabelValues().Observe(us) + i.metrics.Duration.WithLabelValues().Observe(v) + })) + + defer timer.ObserveDuration() + + i.metrics.Counter.WithLabelValues().Inc() + + return i.next.List(ctx, userId) +} + +func (i instrument) GetByInvitedEmail(ctx context.Context, email string) (*invitations.Invitation, error) { + timer := prometheus.NewTimer(prometheus.ObserverFunc(func(v float64) { + us := v * 1000000 + + i.metrics.Latency.WithLabelValues().Observe(us) + i.metrics.Duration.WithLabelValues().Observe(v) + })) + + defer timer.ObserveDuration() + + i.metrics.Counter.WithLabelValues().Inc() + + return i.next.GetByInvitedEmail(ctx, email) +} + // Invite implements the Service interface. func (i instrument) Invite(ctx context.Context, invitation *invitations.Invitation) (*invitations.Invitation, error) { timer := prometheus.NewTimer(prometheus.ObserverFunc(func(v float64) { diff --git a/services/invitations/pkg/service/v0/logging.go b/services/invitations/pkg/service/v0/logging.go index 31f85dd743..b5fe554a09 100644 --- a/services/invitations/pkg/service/v0/logging.go +++ b/services/invitations/pkg/service/v0/logging.go @@ -20,6 +20,22 @@ type logging struct { logger log.Logger } +func (l logging) List(ctx context.Context, userId string) ([]*invitations.Invitation, error) { + l.logger.Debug(). + Interface("invitation", "list"). + Msg("List") + + return l.next.List(ctx, userId) +} + +func (l logging) GetByInvitedEmail(ctx context.Context, email string) (*invitations.Invitation, error) { + l.logger.Debug(). + Interface("invitation", email). + Msg("Get") + + return l.next.GetByInvitedEmail(ctx, email) +} + // Invite implements the Service interface. func (l logging) Invite(ctx context.Context, invitation *invitations.Invitation) (*invitations.Invitation, error) { l.logger.Debug(). diff --git a/services/invitations/pkg/service/v0/option.go b/services/invitations/pkg/service/v0/option.go index 8be0cb1855..5b4bdc6cea 100644 --- a/services/invitations/pkg/service/v0/option.go +++ b/services/invitations/pkg/service/v0/option.go @@ -3,6 +3,7 @@ package service import ( "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config" + "go-micro.dev/v4/store" ) // Option defines a single option function. @@ -12,6 +13,8 @@ type Option func(o *Options) type Options struct { Logger log.Logger Config *config.Config + + Persistance *store.Store } // newOptions initializes the available default options. @@ -38,3 +41,9 @@ func Config(val *config.Config) Option { o.Config = val } } + +func WithPersistance(val *store.Store) Option { + return func(o *Options) { + o.Persistance = val + } +} diff --git a/services/invitations/pkg/service/v0/service.go b/services/invitations/pkg/service/v0/service.go index 8d016c6178..e999fac5c0 100644 --- a/services/invitations/pkg/service/v0/service.go +++ b/services/invitations/pkg/service/v0/service.go @@ -2,12 +2,16 @@ package service import ( "context" + "encoding/json" "fmt" + "github.com/google/uuid" "github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/services/invitations/pkg/backends/keycloak" "github.com/opencloud-eu/opencloud/services/invitations/pkg/config" "github.com/opencloud-eu/opencloud/services/invitations/pkg/invitations" + revactx "github.com/opencloud-eu/reva/v2/pkg/ctx" + "go-micro.dev/v4/store" ) // Service defines the extension handlers. @@ -27,6 +31,8 @@ type Service interface { // invited user has to go through the redemption process to access any // resources they have been invited to. Invite(ctx context.Context, invitation *invitations.Invitation) (*invitations.Invitation, error) + List(ctx context.Context, userId string) ([]*invitations.Invitation, error) + GetByInvitedEmail(ctx context.Context, email string) (*invitations.Invitation, error) } // Backend defines the behaviour of a user backend. @@ -54,17 +60,33 @@ func New(opts ...Option) (Service, error) { options.Config.Keycloak.InsecureSkipVerify, ) - return svc{ + s := svc{ log: options.Logger, config: options.Config, backend: backend, - }, nil + } + switch options.Config.Persistance.Store { + case "nat-js-kv": + panic("not implemented yet") + case "memory": + s.persistance = store.NewMemoryStore() + default: + panic("unknown store") + } + + if err := s.persistance.Init(store.Table("invitations")); err != nil { + s.log.Error().Err(err).Msg("error initializing store") + return nil, err + } + return s, nil } type svc struct { config *config.Config log log.Logger backend Backend + + persistance store.Store } // Invite implements the service interface @@ -77,19 +99,90 @@ func (s svc) Invite(ctx context.Context, invitation *invitations.Invitation) (*i return nil, ErrMissingEmail } - id, err := s.backend.CreateUser(ctx, invitation) + if s.config.UseBackEndForInvitations { + id, err := s.backend.CreateUser(ctx, invitation) + if err != nil { + return nil, fmt.Errorf("%w: %s", ErrBackend, err) + } + + // As we only have a single backend, and that backend supports email, we don't have + // any code to handle mailing ourself yet. + if s.backend.CanSendMail() { + err := s.backend.SendMail(ctx, id) + if err != nil { + return nil, fmt.Errorf("%w: %s", ErrBackend, err) + } + } + } + + // get logged in user + u, ok := revactx.ContextGetUser(ctx) + if !ok { + return nil, ErrUnauthorized + } + + // serialize invitation + invitationBytes, err := json.Marshal(invitation) + if err != nil { + return nil, fmt.Errorf("%w: %s", ErrSerialization, err) + } + + // persist invitation + err = s.persistance.Write(&store.Record{ + Key: uuid.New().String(), + // TODO: Fixme: persisting metadata does not help if you can not read it + Metadata: map[string]interface{}{ + "invitedUserEmailAddress": invitation.InvitedUserEmailAddress, + "inviterUserId": u.GetId(), + }, + Value: invitationBytes}) + + if err != nil { + return nil, fmt.Errorf("%w: %s", ErrPersistence, err) + } + + return invitation, nil +} + +// List implements the service interface +func (s svc) List(ctx context.Context, userId string) ([]*invitations.Invitation, error) { + fmt.Println("list invitations for user", userId) + // get logged in user + _, ok := revactx.ContextGetUser(ctx) + if !ok { + return nil, ErrUnauthorized + } + + invitationsKeys, err := s.persistance.List() + if err != nil { - return nil, fmt.Errorf("%w: %s", ErrBackend, err) + return nil, fmt.Errorf("%w: %s", ErrPersistence, err) } - // As we only have a single backend, and that backend supports email, we don't have - // any code to handle mailing ourself yet. - if s.backend.CanSendMail() { - err := s.backend.SendMail(ctx, id) + invSlice := []*invitations.Invitation{} + + for _, key := range invitationsKeys { + // TODO: fixme: we can not read the metadata back again (WTF) + invs, err := s.persistance.Read(key) if err != nil { - return nil, fmt.Errorf("%w: %s", ErrBackend, err) + // we cannot get the item, probably deleted in the meantime + continue + } + for _, value := range invs { + inv := &invitations.Invitation{} + err := json.Unmarshal(value.Value, inv) + if err != nil { + return nil, fmt.Errorf("%w: %s", ErrSerialization, err) + } + invSlice = append(invSlice, inv) } } + return invSlice, nil +} - return invitation, nil +// GetByInvitedEmail implements the service interface +func (s svc) GetByInvitedEmail(ctx context.Context, email string) (*invitations.Invitation, error) { + // TODO: implement + panic("implement me") + return nil, nil } diff --git a/services/invitations/pkg/service/v0/service_test.go b/services/invitations/pkg/service/v0/service_test.go new file mode 100644 index 0000000000..b2958aabac --- /dev/null +++ b/services/invitations/pkg/service/v0/service_test.go @@ -0,0 +1,113 @@ +package service_test + +import ( + "context" + + "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/opencloud-eu/opencloud/pkg/log" + "github.com/opencloud-eu/opencloud/services/invitations/pkg/config" + "github.com/opencloud-eu/opencloud/services/invitations/pkg/invitations" + "github.com/opencloud-eu/opencloud/services/invitations/pkg/service/v0" + revactx "github.com/opencloud-eu/reva/v2/pkg/ctx" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Service", func() { + var ( + testSvc service.Service + ctx context.Context + invite *invitations.Invitation + ) + BeforeEach(func() { + ctx = context.Background() + var err error + cfg := &config.Config{ + UseBackEndForInvitations: false, + Persistance: config.Persistance{ + Store: "memory", + }, + } + + testSvc, err = service.New( + service.Logger(log.NewLogger()), + service.Config(cfg), + ) + if err != nil { + panic(err) + } + + invite = &invitations.Invitation{ + InvitedUserEmailAddress: "test@example.com", + } + }) + + Describe("Invite", func() { + It("should return an error if no user is authorized", func() { + inv, err := testSvc.Invite(ctx, invite) + Expect(err).To(HaveOccurred()) + Expect(err).To(MatchError(service.ErrUnauthorized)) + Expect(inv).To(BeNil()) + }) + It("should return an invitation", func() { + ctx = revactx.ContextSetUser(ctx, &userv1beta1.User{ + Id: &userv1beta1.UserId{ + OpaqueId: "testuser", + }, + }) + inv, err := testSvc.Invite(ctx, invite) + Expect(err).ToNot(HaveOccurred()) + Expect(inv).ToNot(BeNil()) + }) + It("should return an error if the email is invalid", func() { + invite := &invitations.Invitation{ + InvitedUserEmailAddress: "test", + } + inv, err := testSvc.Invite(ctx, invite) + Expect(err).To(HaveOccurred()) + Expect(inv).To(BeNil()) + }) + }) + + Describe("List", func() { + It("should return a list of invitations", func() { + user := &userv1beta1.User{ + Id: &userv1beta1.UserId{ + OpaqueId: "testuser", + }, + } + ctx = revactx.ContextSetUser(ctx, user) + + // create a slice of invitations + invitations := []*invitations.Invitation{ + { + InvitedUserEmailAddress: "test@example.org", + }, + { + InvitedUserEmailAddress: "test2@example.org", + }, + } + for _, inv := range invitations { + _, err := testSvc.Invite(ctx, inv) + Expect(err).ToNot(HaveOccurred()) + } + + inv, err := testSvc.List(ctx, user.GetId().GetOpaqueId()) + Expect(err).ToNot(HaveOccurred()) + Expect(inv).ToNot(BeNil()) + }) + }) + Describe("GetByInvitedEmail", func() { + It("should return an invitation", func() { + ctx = revactx.ContextSetUser(ctx, &userv1beta1.User{ + Id: &userv1beta1.UserId{ + OpaqueId: "testuser", + }, + }) + inv, err := testSvc.GetByInvitedEmail(ctx, "test@example.org") + Expect(err).ToNot(HaveOccurred()) + Expect(inv).ToNot(BeNil()) + }) + }) +}) diff --git a/services/invitations/pkg/service/v0/tracing.go b/services/invitations/pkg/service/v0/tracing.go index d55ad07ab5..107b12ba09 100644 --- a/services/invitations/pkg/service/v0/tracing.go +++ b/services/invitations/pkg/service/v0/tracing.go @@ -21,6 +21,34 @@ type tracing struct { tp trace.TracerProvider } +func (t tracing) List(ctx context.Context, userId string) ([]*invitations.Invitation, error) { + spanOpts := []trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindServer), + trace.WithAttributes( + attribute.KeyValue{ + Key: "invitation", Value: attribute.StringValue("list"), + }), + } + ctx, span := t.tp.Tracer("invitations").Start(ctx, "List", spanOpts...) + defer span.End() + + return t.next.List(ctx, userId) +} + +func (t tracing) GetByInvitedEmail(ctx context.Context, email string) (*invitations.Invitation, error) { + spanOpts := []trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindServer), + trace.WithAttributes( + attribute.KeyValue{ + Key: "invitation", Value: attribute.StringValue("get"), + }), + } + ctx, span := t.tp.Tracer("invitations").Start(ctx, "Get", spanOpts...) + defer span.End() + + return t.next.GetByInvitedEmail(ctx, email) +} + // Invite implements the Service interface. func (t tracing) Invite(ctx context.Context, invitation *invitations.Invitation) (*invitations.Invitation, error) { spanOpts := []trace.SpanStartOption{ diff --git a/services/invitations/pkg/service/v0/v0_suite_test.go b/services/invitations/pkg/service/v0/v0_suite_test.go new file mode 100644 index 0000000000..d906ab9e37 --- /dev/null +++ b/services/invitations/pkg/service/v0/v0_suite_test.go @@ -0,0 +1,13 @@ +package service_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestV0(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "V0 Suite") +} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/README.md b/vendor/github.com/opencloud-eu/libre-graph-api-go/README.md index 71136c7049..4dcf488898 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/README.md +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/README.md @@ -141,10 +141,15 @@ Class | Method | HTTP request | Description *GroupApi* | [**UpdateGroup**](docs/GroupApi.md#updategroup) | **Patch** /v1.0/groups/{group-id} | Update entity in groups *GroupsApi* | [**CreateGroup**](docs/GroupsApi.md#creategroup) | **Post** /v1.0/groups | Add new entity to groups *GroupsApi* | [**ListGroups**](docs/GroupsApi.md#listgroups) | **Get** /v1.0/groups | Get entities from groups +*InvitationsApi* | [**CreateInvitation**](docs/InvitationsApi.md#createinvitation) | **Post** /v1.0/invitations | Create a new invitation +*InvitationsApi* | [**GetInvitation**](docs/InvitationsApi.md#getinvitation) | **Get** /v1.0/invitations/{invitation-id} | Get an invitation by key +*InvitationsApi* | [**ListInvitations**](docs/InvitationsApi.md#listinvitations) | **Get** /v1.0/invitations | Get a list of invitations *MeChangepasswordApi* | [**ChangeOwnPassword**](docs/MeChangepasswordApi.md#changeownpassword) | **Post** /v1.0/me/changePassword | Change your own password +*MeDriveApi* | [**FollowDriveItem**](docs/MeDriveApi.md#followdriveitem) | **Post** /v1.0/me/drive/items/{item-id}/follow | Follow a DriveItem *MeDriveApi* | [**GetHome**](docs/MeDriveApi.md#gethome) | **Get** /v1.0/me/drive | Get personal space for user *MeDriveApi* | [**ListSharedByMe**](docs/MeDriveApi.md#listsharedbyme) | **Get** /v1beta1/me/drive/sharedByMe | Get a list of driveItem objects shared by the current user. *MeDriveApi* | [**ListSharedWithMe**](docs/MeDriveApi.md#listsharedwithme) | **Get** /v1beta1/me/drive/sharedWithMe | Get a list of driveItem objects shared with the owner of a drive. +*MeDriveApi* | [**UnfollowDriveItem**](docs/MeDriveApi.md#unfollowdriveitem) | **Delete** /v1.0/me/drive/following/{item-id} | Unfollow a DriveItem *MeDriveRootApi* | [**HomeGetRoot**](docs/MeDriveRootApi.md#homegetroot) | **Get** /v1.0/me/drive/root | Get root from personal space *MeDriveRootChildrenApi* | [**HomeGetChildren**](docs/MeDriveRootChildrenApi.md#homegetchildren) | **Get** /v1.0/me/drive/root/children | Get children from drive *MeDrivesApi* | [**ListMyDrives**](docs/MeDrivesApi.md#listmydrives) | **Get** /v1.0/me/drives | Get all drives where the current user is a regular member of @@ -195,6 +200,7 @@ Class | Method | HTTP request | Description - [CollectionOfEducationClass](docs/CollectionOfEducationClass.md) - [CollectionOfEducationUser](docs/CollectionOfEducationUser.md) - [CollectionOfGroup](docs/CollectionOfGroup.md) + - [CollectionOfInvitations](docs/CollectionOfInvitations.md) - [CollectionOfPermissions](docs/CollectionOfPermissions.md) - [CollectionOfPermissionsWithAllowedValues](docs/CollectionOfPermissionsWithAllowedValues.md) - [CollectionOfSchools](docs/CollectionOfSchools.md) @@ -212,6 +218,7 @@ Class | Method | HTTP request | Description - [EducationSchool](docs/EducationSchool.md) - [EducationUser](docs/EducationUser.md) - [EducationUserReference](docs/EducationUserReference.md) + - [EmailAddress](docs/EmailAddress.md) - [ExportPersonalDataRequest](docs/ExportPersonalDataRequest.md) - [FileSystemInfo](docs/FileSystemInfo.md) - [Folder](docs/Folder.md) @@ -222,6 +229,8 @@ Class | Method | HTTP request | Description - [Identity](docs/Identity.md) - [IdentitySet](docs/IdentitySet.md) - [Image](docs/Image.md) + - [Invitation](docs/Invitation.md) + - [InvitedUserMessageInfo](docs/InvitedUserMessageInfo.md) - [ItemReference](docs/ItemReference.md) - [MemberReference](docs/MemberReference.md) - [ObjectIdentity](docs/ObjectIdentity.md) @@ -234,6 +243,7 @@ Class | Method | HTTP request | Description - [Permission](docs/Permission.md) - [Photo](docs/Photo.md) - [Quota](docs/Quota.md) + - [Recipient](docs/Recipient.md) - [RemoteItem](docs/RemoteItem.md) - [SharePointIdentitySet](docs/SharePointIdentitySet.md) - [SharingInvitation](docs/SharingInvitation.md) diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_school.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_school.go index 761504d152..0f00b1f6aa 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_school.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_school.go @@ -994,6 +994,13 @@ func (a *EducationSchoolApiService) ListSchoolUsersExecute(r ApiListSchoolUsersR type ApiListSchoolsRequest struct { ctx context.Context ApiService *EducationSchoolApiService + filter *string +} + +// Filter items by property values. Supports a subset of OData filter expressions. **Supported filters:** - By external ID: `externalId eq 'ext_12345'` +func (r ApiListSchoolsRequest) Filter(filter string) ApiListSchoolsRequest { + r.filter = &filter + return r } func (r ApiListSchoolsRequest) Execute() (*CollectionOfSchools, *http.Response, error) { @@ -1003,6 +1010,13 @@ func (r ApiListSchoolsRequest) Execute() (*CollectionOfSchools, *http.Response, /* ListSchools Get a list of schools and their properties +Retrieves a collection of education schools with optional filtering and ordering. + +**Filtering by external ID:** +Use `$filter` to query schools by their external identifier, for example: +`$filter=externalId eq 'EX12345'` + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiListSchoolsRequest */ @@ -1034,6 +1048,9 @@ func (a *EducationSchoolApiService) ListSchoolsExecute(r ApiListSchoolsRequest) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.filter != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$filter", r.filter, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_user.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_user.go index 37ca4d2bf9..13b1db8540 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_user.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_education_user.go @@ -165,7 +165,7 @@ See the [ListEducationUsers](#/educationUser/ListEducationUsers) operation for q @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param userId key: internal user id (UUID format) or username of user. **Note:** If you only have an external ID, first query the user with `GET /graph/v1.0/education/users?$filter=externalId eq '{value}'` to retrieve the internal ID. + @param userId key: internal user id (UUID format) or username of user. **Note:** If you only have an external ID, first query the user with `GET /graph/v1.0/education/users?$filter=externalId eq '{value}'` to retrieve the internal ID. @return ApiDeleteEducationUserRequest */ func (a *EducationUserApiService) DeleteEducationUser(ctx context.Context, userId string) ApiDeleteEducationUserRequest { diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_invitations.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_invitations.go new file mode 100644 index 0000000000..bafad29ea7 --- /dev/null +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_invitations.go @@ -0,0 +1,328 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.8 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// InvitationsApiService InvitationsApi service +type InvitationsApiService service + +type ApiCreateInvitationRequest struct { + ctx context.Context + ApiService *InvitationsApiService + invitation *Invitation +} + +// New invitation +func (r ApiCreateInvitationRequest) Invitation(invitation Invitation) ApiCreateInvitationRequest { + r.invitation = &invitation + return r +} + +func (r ApiCreateInvitationRequest) Execute() (*Invitation, *http.Response, error) { + return r.ApiService.CreateInvitationExecute(r) +} + +/* +CreateInvitation Create a new invitation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateInvitationRequest +*/ +func (a *InvitationsApiService) CreateInvitation(ctx context.Context) ApiCreateInvitationRequest { + return ApiCreateInvitationRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return Invitation +func (a *InvitationsApiService) CreateInvitationExecute(r ApiCreateInvitationRequest) (*Invitation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Invitation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvitationsApiService.CreateInvitation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1.0/invitations" + + 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.invitation + 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, + } + 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 ApiGetInvitationRequest struct { + ctx context.Context + ApiService *InvitationsApiService + invitationId string +} + +func (r ApiGetInvitationRequest) Execute() (*Invitation, *http.Response, error) { + return r.ApiService.GetInvitationExecute(r) +} + +/* +GetInvitation Get an invitation by key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param invitationId key: id of invitation + @return ApiGetInvitationRequest +*/ +func (a *InvitationsApiService) GetInvitation(ctx context.Context, invitationId string) ApiGetInvitationRequest { + return ApiGetInvitationRequest{ + ApiService: a, + ctx: ctx, + invitationId: invitationId, + } +} + +// Execute executes the request +// @return Invitation +func (a *InvitationsApiService) GetInvitationExecute(r ApiGetInvitationRequest) (*Invitation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Invitation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvitationsApiService.GetInvitation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1.0/invitations/{invitation-id}" + localVarPath = strings.Replace(localVarPath, "{"+"invitation-id"+"}", url.PathEscape(parameterValueToString(r.invitationId, "invitationId")), -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, + } + 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 ApiListInvitationsRequest struct { + ctx context.Context + ApiService *InvitationsApiService +} + +func (r ApiListInvitationsRequest) Execute() (*CollectionOfInvitations, *http.Response, error) { + return r.ApiService.ListInvitationsExecute(r) +} + +/* +ListInvitations Get a list of invitations + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListInvitationsRequest +*/ +func (a *InvitationsApiService) ListInvitations(ctx context.Context) ApiListInvitationsRequest { + return ApiListInvitationsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return CollectionOfInvitations +func (a *InvitationsApiService) ListInvitationsExecute(r ApiListInvitationsRequest) (*CollectionOfInvitations, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CollectionOfInvitations + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvitationsApiService.ListInvitations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1.0/invitations" + + 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, + } + 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/opencloud-eu/libre-graph-api-go/api_me_drive.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drive.go index ef79c7fe47..fb55216429 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drive.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drive.go @@ -16,12 +16,124 @@ import ( "io" "net/http" "net/url" + "strings" ) // MeDriveApiService MeDriveApi service type MeDriveApiService service +type ApiFollowDriveItemRequest struct { + ctx context.Context + ApiService *MeDriveApiService + itemId string +} + +func (r ApiFollowDriveItemRequest) Execute() (*DriveItem, *http.Response, error) { + return r.ApiService.FollowDriveItemExecute(r) +} + +/* +FollowDriveItem Follow a DriveItem + +Follow a DriveItem. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param itemId key: id of item + @return ApiFollowDriveItemRequest +*/ +func (a *MeDriveApiService) FollowDriveItem(ctx context.Context, itemId string) ApiFollowDriveItemRequest { + return ApiFollowDriveItemRequest{ + ApiService: a, + ctx: ctx, + itemId: itemId, + } +} + +// Execute executes the request +// @return DriveItem +func (a *MeDriveApiService) FollowDriveItemExecute(r ApiFollowDriveItemRequest) (*DriveItem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DriveItem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MeDriveApiService.FollowDriveItem") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1.0/me/drive/items/{item-id}/follow" + 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 ApiGetHomeRequest struct { ctx context.Context ApiService *MeDriveApiService @@ -362,3 +474,103 @@ func (a *MeDriveApiService) ListSharedWithMeExecute(r ApiListSharedWithMeRequest return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiUnfollowDriveItemRequest struct { + ctx context.Context + ApiService *MeDriveApiService + itemId string +} + +func (r ApiUnfollowDriveItemRequest) Execute() (*http.Response, error) { + return r.ApiService.UnfollowDriveItemExecute(r) +} + +/* +UnfollowDriveItem Unfollow a DriveItem + +Unfollow a DriveItem. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param itemId key: id of item + @return ApiUnfollowDriveItemRequest +*/ +func (a *MeDriveApiService) UnfollowDriveItem(ctx context.Context, itemId string) ApiUnfollowDriveItemRequest { + return ApiUnfollowDriveItemRequest{ + ApiService: a, + ctx: ctx, + itemId: itemId, + } +} + +// Execute executes the request +func (a *MeDriveApiService) UnfollowDriveItemExecute(r ApiUnfollowDriveItemRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MeDriveApiService.UnfollowDriveItem") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1.0/me/drive/following/{item-id}" + 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 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 +} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_role_management.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_role_management.go index 9bda43bcba..3e86c714fa 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_role_management.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_role_management.go @@ -140,7 +140,7 @@ type ApiListPermissionRoleDefinitionsRequest struct { ApiService *RoleManagementApiService } -func (r ApiListPermissionRoleDefinitionsRequest) Execute() (*UnifiedRoleDefinition, *http.Response, error) { +func (r ApiListPermissionRoleDefinitionsRequest) Execute() ([]UnifiedRoleDefinition, *http.Response, error) { return r.ApiService.ListPermissionRoleDefinitionsExecute(r) } @@ -161,13 +161,13 @@ func (a *RoleManagementApiService) ListPermissionRoleDefinitions(ctx context.Con } // Execute executes the request -// @return UnifiedRoleDefinition -func (a *RoleManagementApiService) ListPermissionRoleDefinitionsExecute(r ApiListPermissionRoleDefinitionsRequest) (*UnifiedRoleDefinition, *http.Response, error) { +// @return []UnifiedRoleDefinition +func (a *RoleManagementApiService) ListPermissionRoleDefinitionsExecute(r ApiListPermissionRoleDefinitionsRequest) ([]UnifiedRoleDefinition, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *UnifiedRoleDefinition + localVarReturnValue []UnifiedRoleDefinition ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RoleManagementApiService.ListPermissionRoleDefinitions") diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/client.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/client.go index 55ea08b14f..8e5063afee 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/client.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/client.go @@ -75,6 +75,8 @@ type APIClient struct { GroupsApi *GroupsApiService + InvitationsApi *InvitationsApiService + MeChangepasswordApi *MeChangepasswordApiService MeDriveApi *MeDriveApiService @@ -131,6 +133,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.EducationUserApi = (*EducationUserApiService)(&c.common) c.GroupApi = (*GroupApiService)(&c.common) c.GroupsApi = (*GroupsApiService)(&c.common) + c.InvitationsApi = (*InvitationsApiService)(&c.common) c.MeChangepasswordApi = (*MeChangepasswordApiService)(&c.common) c.MeDriveApi = (*MeDriveApiService)(&c.common) c.MeDriveRootApi = (*MeDriveRootApiService)(&c.common) diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_invitations.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_invitations.go new file mode 100644 index 0000000000..181d030ce7 --- /dev/null +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_invitations.go @@ -0,0 +1,126 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.8 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the CollectionOfInvitations type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CollectionOfInvitations{} + +// CollectionOfInvitations struct for CollectionOfInvitations +type CollectionOfInvitations struct { + Value []Invitation `json:"value,omitempty"` +} + +// NewCollectionOfInvitations instantiates a new CollectionOfInvitations 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 NewCollectionOfInvitations() *CollectionOfInvitations { + this := CollectionOfInvitations{} + return &this +} + +// NewCollectionOfInvitationsWithDefaults instantiates a new CollectionOfInvitations 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 NewCollectionOfInvitationsWithDefaults() *CollectionOfInvitations { + this := CollectionOfInvitations{} + return &this +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *CollectionOfInvitations) GetValue() []Invitation { + if o == nil || IsNil(o.Value) { + var ret []Invitation + 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 *CollectionOfInvitations) GetValueOk() ([]Invitation, 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 *CollectionOfInvitations) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given []Invitation and assigns it to the Value field. +func (o *CollectionOfInvitations) SetValue(v []Invitation) { + o.Value = v +} + +func (o CollectionOfInvitations) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CollectionOfInvitations) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + return toSerialize, nil +} + +type NullableCollectionOfInvitations struct { + value *CollectionOfInvitations + isSet bool +} + +func (v NullableCollectionOfInvitations) Get() *CollectionOfInvitations { + return v.value +} + +func (v *NullableCollectionOfInvitations) Set(val *CollectionOfInvitations) { + v.value = val + v.isSet = true +} + +func (v NullableCollectionOfInvitations) IsSet() bool { + return v.isSet +} + +func (v *NullableCollectionOfInvitations) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCollectionOfInvitations(val *CollectionOfInvitations) *NullableCollectionOfInvitations { + return &NullableCollectionOfInvitations{value: val, isSet: true} +} + +func (v NullableCollectionOfInvitations) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCollectionOfInvitations) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_email_address.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_email_address.go new file mode 100644 index 0000000000..b1370999b4 --- /dev/null +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_email_address.go @@ -0,0 +1,164 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.8 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the EmailAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EmailAddress{} + +// EmailAddress Represents an email address. +type EmailAddress struct { + // The email address. + Address *string `json:"address,omitempty"` + // The name associated with the email address. + Name *string `json:"name,omitempty"` +} + +// NewEmailAddress instantiates a new EmailAddress 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 NewEmailAddress() *EmailAddress { + this := EmailAddress{} + return &this +} + +// NewEmailAddressWithDefaults instantiates a new EmailAddress 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 NewEmailAddressWithDefaults() *EmailAddress { + this := EmailAddress{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *EmailAddress) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EmailAddress) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *EmailAddress) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *EmailAddress) SetAddress(v string) { + o.Address = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *EmailAddress) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EmailAddress) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *EmailAddress) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *EmailAddress) SetName(v string) { + o.Name = &v +} + +func (o EmailAddress) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EmailAddress) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableEmailAddress struct { + value *EmailAddress + isSet bool +} + +func (v NullableEmailAddress) Get() *EmailAddress { + return v.value +} + +func (v *NullableEmailAddress) Set(val *EmailAddress) { + v.value = val + v.isSet = true +} + +func (v NullableEmailAddress) IsSet() bool { + return v.isSet +} + +func (v *NullableEmailAddress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEmailAddress(val *EmailAddress) *NullableEmailAddress { + return &NullableEmailAddress{value: val, isSet: true} +} + +func (v NullableEmailAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEmailAddress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_invitation.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_invitation.go new file mode 100644 index 0000000000..dcd97e9deb --- /dev/null +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_invitation.go @@ -0,0 +1,421 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.8 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the Invitation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Invitation{} + +// Invitation Represents an invitation to a drive item. +type Invitation struct { + // The display name of the user being invited. + InvitedUserDisplayName *string `json:"invitedUserDisplayName,omitempty"` + // The email address of the user being invited. Required. + InvitedUserEmailAddress *string `json:"invitedUserEmailAddress,omitempty"` + InvitedUserMessageInfo *InvitedUserMessageInfo `json:"invitedUserMessageInfo,omitempty"` + // Indicates whether an invitation message should be sent to the user. + SendInvitationMessage *bool `json:"sendInvitationMessage,omitempty"` + // The URL to which the user is redirected after accepting the invitation. Required. + InviteRedirectUrl *string `json:"inviteRedirectUrl,omitempty"` + // The URL that the user can use to redeem the invitation. Read-only. + InviteRedeemUrl *string `json:"inviteRedeemUrl,omitempty"` + // The status of the invitation. Read-only. + Status *string `json:"status,omitempty"` + InvitedUser *User `json:"invitedUser,omitempty"` + // The type of user being invited. + InvitedUserType *string `json:"invitedUserType,omitempty"` +} + +// NewInvitation instantiates a new Invitation 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 NewInvitation() *Invitation { + this := Invitation{} + return &this +} + +// NewInvitationWithDefaults instantiates a new Invitation 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 NewInvitationWithDefaults() *Invitation { + this := Invitation{} + return &this +} + +// GetInvitedUserDisplayName returns the InvitedUserDisplayName field value if set, zero value otherwise. +func (o *Invitation) GetInvitedUserDisplayName() string { + if o == nil || IsNil(o.InvitedUserDisplayName) { + var ret string + return ret + } + return *o.InvitedUserDisplayName +} + +// GetInvitedUserDisplayNameOk returns a tuple with the InvitedUserDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitedUserDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.InvitedUserDisplayName) { + return nil, false + } + return o.InvitedUserDisplayName, true +} + +// HasInvitedUserDisplayName returns a boolean if a field has been set. +func (o *Invitation) HasInvitedUserDisplayName() bool { + if o != nil && !IsNil(o.InvitedUserDisplayName) { + return true + } + + return false +} + +// SetInvitedUserDisplayName gets a reference to the given string and assigns it to the InvitedUserDisplayName field. +func (o *Invitation) SetInvitedUserDisplayName(v string) { + o.InvitedUserDisplayName = &v +} + +// GetInvitedUserEmailAddress returns the InvitedUserEmailAddress field value if set, zero value otherwise. +func (o *Invitation) GetInvitedUserEmailAddress() string { + if o == nil || IsNil(o.InvitedUserEmailAddress) { + var ret string + return ret + } + return *o.InvitedUserEmailAddress +} + +// GetInvitedUserEmailAddressOk returns a tuple with the InvitedUserEmailAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitedUserEmailAddressOk() (*string, bool) { + if o == nil || IsNil(o.InvitedUserEmailAddress) { + return nil, false + } + return o.InvitedUserEmailAddress, true +} + +// HasInvitedUserEmailAddress returns a boolean if a field has been set. +func (o *Invitation) HasInvitedUserEmailAddress() bool { + if o != nil && !IsNil(o.InvitedUserEmailAddress) { + return true + } + + return false +} + +// SetInvitedUserEmailAddress gets a reference to the given string and assigns it to the InvitedUserEmailAddress field. +func (o *Invitation) SetInvitedUserEmailAddress(v string) { + o.InvitedUserEmailAddress = &v +} + +// GetInvitedUserMessageInfo returns the InvitedUserMessageInfo field value if set, zero value otherwise. +func (o *Invitation) GetInvitedUserMessageInfo() InvitedUserMessageInfo { + if o == nil || IsNil(o.InvitedUserMessageInfo) { + var ret InvitedUserMessageInfo + return ret + } + return *o.InvitedUserMessageInfo +} + +// GetInvitedUserMessageInfoOk returns a tuple with the InvitedUserMessageInfo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitedUserMessageInfoOk() (*InvitedUserMessageInfo, bool) { + if o == nil || IsNil(o.InvitedUserMessageInfo) { + return nil, false + } + return o.InvitedUserMessageInfo, true +} + +// HasInvitedUserMessageInfo returns a boolean if a field has been set. +func (o *Invitation) HasInvitedUserMessageInfo() bool { + if o != nil && !IsNil(o.InvitedUserMessageInfo) { + return true + } + + return false +} + +// SetInvitedUserMessageInfo gets a reference to the given InvitedUserMessageInfo and assigns it to the InvitedUserMessageInfo field. +func (o *Invitation) SetInvitedUserMessageInfo(v InvitedUserMessageInfo) { + o.InvitedUserMessageInfo = &v +} + +// GetSendInvitationMessage returns the SendInvitationMessage field value if set, zero value otherwise. +func (o *Invitation) GetSendInvitationMessage() bool { + if o == nil || IsNil(o.SendInvitationMessage) { + var ret bool + return ret + } + return *o.SendInvitationMessage +} + +// GetSendInvitationMessageOk returns a tuple with the SendInvitationMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetSendInvitationMessageOk() (*bool, bool) { + if o == nil || IsNil(o.SendInvitationMessage) { + return nil, false + } + return o.SendInvitationMessage, true +} + +// HasSendInvitationMessage returns a boolean if a field has been set. +func (o *Invitation) HasSendInvitationMessage() bool { + if o != nil && !IsNil(o.SendInvitationMessage) { + return true + } + + return false +} + +// SetSendInvitationMessage gets a reference to the given bool and assigns it to the SendInvitationMessage field. +func (o *Invitation) SetSendInvitationMessage(v bool) { + o.SendInvitationMessage = &v +} + +// GetInviteRedirectUrl returns the InviteRedirectUrl field value if set, zero value otherwise. +func (o *Invitation) GetInviteRedirectUrl() string { + if o == nil || IsNil(o.InviteRedirectUrl) { + var ret string + return ret + } + return *o.InviteRedirectUrl +} + +// GetInviteRedirectUrlOk returns a tuple with the InviteRedirectUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInviteRedirectUrlOk() (*string, bool) { + if o == nil || IsNil(o.InviteRedirectUrl) { + return nil, false + } + return o.InviteRedirectUrl, true +} + +// HasInviteRedirectUrl returns a boolean if a field has been set. +func (o *Invitation) HasInviteRedirectUrl() bool { + if o != nil && !IsNil(o.InviteRedirectUrl) { + return true + } + + return false +} + +// SetInviteRedirectUrl gets a reference to the given string and assigns it to the InviteRedirectUrl field. +func (o *Invitation) SetInviteRedirectUrl(v string) { + o.InviteRedirectUrl = &v +} + +// GetInviteRedeemUrl returns the InviteRedeemUrl field value if set, zero value otherwise. +func (o *Invitation) GetInviteRedeemUrl() string { + if o == nil || IsNil(o.InviteRedeemUrl) { + var ret string + return ret + } + return *o.InviteRedeemUrl +} + +// GetInviteRedeemUrlOk returns a tuple with the InviteRedeemUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInviteRedeemUrlOk() (*string, bool) { + if o == nil || IsNil(o.InviteRedeemUrl) { + return nil, false + } + return o.InviteRedeemUrl, true +} + +// HasInviteRedeemUrl returns a boolean if a field has been set. +func (o *Invitation) HasInviteRedeemUrl() bool { + if o != nil && !IsNil(o.InviteRedeemUrl) { + return true + } + + return false +} + +// SetInviteRedeemUrl gets a reference to the given string and assigns it to the InviteRedeemUrl field. +func (o *Invitation) SetInviteRedeemUrl(v string) { + o.InviteRedeemUrl = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Invitation) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Invitation) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Invitation) SetStatus(v string) { + o.Status = &v +} + +// GetInvitedUser returns the InvitedUser field value if set, zero value otherwise. +func (o *Invitation) GetInvitedUser() User { + if o == nil || IsNil(o.InvitedUser) { + var ret User + return ret + } + return *o.InvitedUser +} + +// GetInvitedUserOk returns a tuple with the InvitedUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitedUserOk() (*User, bool) { + if o == nil || IsNil(o.InvitedUser) { + return nil, false + } + return o.InvitedUser, true +} + +// HasInvitedUser returns a boolean if a field has been set. +func (o *Invitation) HasInvitedUser() bool { + if o != nil && !IsNil(o.InvitedUser) { + return true + } + + return false +} + +// SetInvitedUser gets a reference to the given User and assigns it to the InvitedUser field. +func (o *Invitation) SetInvitedUser(v User) { + o.InvitedUser = &v +} + +// GetInvitedUserType returns the InvitedUserType field value if set, zero value otherwise. +func (o *Invitation) GetInvitedUserType() string { + if o == nil || IsNil(o.InvitedUserType) { + var ret string + return ret + } + return *o.InvitedUserType +} + +// GetInvitedUserTypeOk returns a tuple with the InvitedUserType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitedUserTypeOk() (*string, bool) { + if o == nil || IsNil(o.InvitedUserType) { + return nil, false + } + return o.InvitedUserType, true +} + +// HasInvitedUserType returns a boolean if a field has been set. +func (o *Invitation) HasInvitedUserType() bool { + if o != nil && !IsNil(o.InvitedUserType) { + return true + } + + return false +} + +// SetInvitedUserType gets a reference to the given string and assigns it to the InvitedUserType field. +func (o *Invitation) SetInvitedUserType(v string) { + o.InvitedUserType = &v +} + +func (o Invitation) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Invitation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.InvitedUserDisplayName) { + toSerialize["invitedUserDisplayName"] = o.InvitedUserDisplayName + } + if !IsNil(o.InvitedUserEmailAddress) { + toSerialize["invitedUserEmailAddress"] = o.InvitedUserEmailAddress + } + if !IsNil(o.InvitedUserMessageInfo) { + toSerialize["invitedUserMessageInfo"] = o.InvitedUserMessageInfo + } + if !IsNil(o.SendInvitationMessage) { + toSerialize["sendInvitationMessage"] = o.SendInvitationMessage + } + if !IsNil(o.InviteRedirectUrl) { + toSerialize["inviteRedirectUrl"] = o.InviteRedirectUrl + } + if !IsNil(o.InviteRedeemUrl) { + toSerialize["inviteRedeemUrl"] = o.InviteRedeemUrl + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.InvitedUser) { + toSerialize["invitedUser"] = o.InvitedUser + } + if !IsNil(o.InvitedUserType) { + toSerialize["invitedUserType"] = o.InvitedUserType + } + return toSerialize, nil +} + +type NullableInvitation struct { + value *Invitation + isSet bool +} + +func (v NullableInvitation) Get() *Invitation { + return v.value +} + +func (v *NullableInvitation) Set(val *Invitation) { + v.value = val + v.isSet = true +} + +func (v NullableInvitation) IsSet() bool { + return v.isSet +} + +func (v *NullableInvitation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvitation(val *Invitation) *NullableInvitation { + return &NullableInvitation{value: val, isSet: true} +} + +func (v NullableInvitation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvitation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_invited_user_message_info.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_invited_user_message_info.go new file mode 100644 index 0000000000..0b12ce6275 --- /dev/null +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_invited_user_message_info.go @@ -0,0 +1,201 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.8 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the InvitedUserMessageInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InvitedUserMessageInfo{} + +// InvitedUserMessageInfo Additional information about the invitation message. +type InvitedUserMessageInfo struct { + // Additional recipients who will receive a copy of the invitation message. + CcRecipients []Recipient `json:"ccRecipients,omitempty"` + // The customized message body that will be included in the invitation message. + CustomizedMessageBody *string `json:"customizedMessageBody,omitempty"` + // The language of the invitation message. + MessageLanguage *string `json:"messageLanguage,omitempty"` +} + +// NewInvitedUserMessageInfo instantiates a new InvitedUserMessageInfo 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 NewInvitedUserMessageInfo() *InvitedUserMessageInfo { + this := InvitedUserMessageInfo{} + return &this +} + +// NewInvitedUserMessageInfoWithDefaults instantiates a new InvitedUserMessageInfo 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 NewInvitedUserMessageInfoWithDefaults() *InvitedUserMessageInfo { + this := InvitedUserMessageInfo{} + return &this +} + +// GetCcRecipients returns the CcRecipients field value if set, zero value otherwise. +func (o *InvitedUserMessageInfo) GetCcRecipients() []Recipient { + if o == nil || IsNil(o.CcRecipients) { + var ret []Recipient + return ret + } + return o.CcRecipients +} + +// GetCcRecipientsOk returns a tuple with the CcRecipients field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitedUserMessageInfo) GetCcRecipientsOk() ([]Recipient, bool) { + if o == nil || IsNil(o.CcRecipients) { + return nil, false + } + return o.CcRecipients, true +} + +// HasCcRecipients returns a boolean if a field has been set. +func (o *InvitedUserMessageInfo) HasCcRecipients() bool { + if o != nil && !IsNil(o.CcRecipients) { + return true + } + + return false +} + +// SetCcRecipients gets a reference to the given []Recipient and assigns it to the CcRecipients field. +func (o *InvitedUserMessageInfo) SetCcRecipients(v []Recipient) { + o.CcRecipients = v +} + +// GetCustomizedMessageBody returns the CustomizedMessageBody field value if set, zero value otherwise. +func (o *InvitedUserMessageInfo) GetCustomizedMessageBody() string { + if o == nil || IsNil(o.CustomizedMessageBody) { + var ret string + return ret + } + return *o.CustomizedMessageBody +} + +// GetCustomizedMessageBodyOk returns a tuple with the CustomizedMessageBody field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitedUserMessageInfo) GetCustomizedMessageBodyOk() (*string, bool) { + if o == nil || IsNil(o.CustomizedMessageBody) { + return nil, false + } + return o.CustomizedMessageBody, true +} + +// HasCustomizedMessageBody returns a boolean if a field has been set. +func (o *InvitedUserMessageInfo) HasCustomizedMessageBody() bool { + if o != nil && !IsNil(o.CustomizedMessageBody) { + return true + } + + return false +} + +// SetCustomizedMessageBody gets a reference to the given string and assigns it to the CustomizedMessageBody field. +func (o *InvitedUserMessageInfo) SetCustomizedMessageBody(v string) { + o.CustomizedMessageBody = &v +} + +// GetMessageLanguage returns the MessageLanguage field value if set, zero value otherwise. +func (o *InvitedUserMessageInfo) GetMessageLanguage() string { + if o == nil || IsNil(o.MessageLanguage) { + var ret string + return ret + } + return *o.MessageLanguage +} + +// GetMessageLanguageOk returns a tuple with the MessageLanguage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitedUserMessageInfo) GetMessageLanguageOk() (*string, bool) { + if o == nil || IsNil(o.MessageLanguage) { + return nil, false + } + return o.MessageLanguage, true +} + +// HasMessageLanguage returns a boolean if a field has been set. +func (o *InvitedUserMessageInfo) HasMessageLanguage() bool { + if o != nil && !IsNil(o.MessageLanguage) { + return true + } + + return false +} + +// SetMessageLanguage gets a reference to the given string and assigns it to the MessageLanguage field. +func (o *InvitedUserMessageInfo) SetMessageLanguage(v string) { + o.MessageLanguage = &v +} + +func (o InvitedUserMessageInfo) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InvitedUserMessageInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CcRecipients) { + toSerialize["ccRecipients"] = o.CcRecipients + } + if !IsNil(o.CustomizedMessageBody) { + toSerialize["customizedMessageBody"] = o.CustomizedMessageBody + } + if !IsNil(o.MessageLanguage) { + toSerialize["messageLanguage"] = o.MessageLanguage + } + return toSerialize, nil +} + +type NullableInvitedUserMessageInfo struct { + value *InvitedUserMessageInfo + isSet bool +} + +func (v NullableInvitedUserMessageInfo) Get() *InvitedUserMessageInfo { + return v.value +} + +func (v *NullableInvitedUserMessageInfo) Set(val *InvitedUserMessageInfo) { + v.value = val + v.isSet = true +} + +func (v NullableInvitedUserMessageInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableInvitedUserMessageInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvitedUserMessageInfo(val *InvitedUserMessageInfo) *NullableInvitedUserMessageInfo { + return &NullableInvitedUserMessageInfo{value: val, isSet: true} +} + +func (v NullableInvitedUserMessageInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvitedUserMessageInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_recipient.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_recipient.go new file mode 100644 index 0000000000..90b22c2dca --- /dev/null +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_recipient.go @@ -0,0 +1,126 @@ +/* +Libre Graph API + +Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + +API version: v1.0.8 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package libregraph + +import ( + "encoding/json" +) + +// checks if the Recipient type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Recipient{} + +// Recipient Represents a recipient of an invitation. +type Recipient struct { + EmailAddress *EmailAddress `json:"emailAddress,omitempty"` +} + +// NewRecipient instantiates a new Recipient 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 NewRecipient() *Recipient { + this := Recipient{} + return &this +} + +// NewRecipientWithDefaults instantiates a new Recipient 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 NewRecipientWithDefaults() *Recipient { + this := Recipient{} + return &this +} + +// GetEmailAddress returns the EmailAddress field value if set, zero value otherwise. +func (o *Recipient) GetEmailAddress() EmailAddress { + if o == nil || IsNil(o.EmailAddress) { + var ret EmailAddress + return ret + } + return *o.EmailAddress +} + +// GetEmailAddressOk returns a tuple with the EmailAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Recipient) GetEmailAddressOk() (*EmailAddress, bool) { + if o == nil || IsNil(o.EmailAddress) { + return nil, false + } + return o.EmailAddress, true +} + +// HasEmailAddress returns a boolean if a field has been set. +func (o *Recipient) HasEmailAddress() bool { + if o != nil && !IsNil(o.EmailAddress) { + return true + } + + return false +} + +// SetEmailAddress gets a reference to the given EmailAddress and assigns it to the EmailAddress field. +func (o *Recipient) SetEmailAddress(v EmailAddress) { + o.EmailAddress = &v +} + +func (o Recipient) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Recipient) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.EmailAddress) { + toSerialize["emailAddress"] = o.EmailAddress + } + return toSerialize, nil +} + +type NullableRecipient struct { + value *Recipient + isSet bool +} + +func (v NullableRecipient) Get() *Recipient { + return v.value +} + +func (v *NullableRecipient) Set(val *Recipient) { + v.value = val + v.isSet = true +} + +func (v NullableRecipient) IsSet() bool { + return v.isSet +} + +func (v *NullableRecipient) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecipient(val *Recipient) *NullableRecipient { + return &NullableRecipient{value: val, isSet: true} +} + +func (v NullableRecipient) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecipient) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/vendor/modules.txt b/vendor/modules.txt index d8c124531d..84f17d9b53 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1373,7 +1373,7 @@ github.com/open-policy-agent/opa/v1/version # github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 ## explicit; go 1.24.6 github.com/opencloud-eu/icap-client -# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260204102724-10bcda1b3068 +# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310095109-64a5650c97e2 ## explicit; go 1.18 github.com/opencloud-eu/libre-graph-api-go # github.com/opencloud-eu/reva/v2 v2.42.5