diff --git a/credentials/config.json b/credentials/config.json index 569dba1..a810c5b 100644 --- a/credentials/config.json +++ b/credentials/config.json @@ -5,7 +5,7 @@ "username": "postgres", "password": "postgres", "host": "0.0.0.0", - "port": 5432, + "port": 5433, "dbname": "credentials" }, "server": { diff --git a/credentials/docker-compose.yml b/credentials/docker-compose.yml index 643d2cf..3eb37e4 100644 --- a/credentials/docker-compose.yml +++ b/credentials/docker-compose.yml @@ -8,7 +8,7 @@ services: POSTGRES_PASSWORD: postgres POSTGRES_DB: credentials ports: - - 5432:5432 + - 5433:5432 volumes: - credential-db-vol:/var/lib/postgresql/data diff --git a/gateway/.air.toml b/gateway/.air.toml new file mode 100644 index 0000000..ae2acc9 --- /dev/null +++ b/gateway/.air.toml @@ -0,0 +1,37 @@ +root = "." +testdata_dir = "testdata" +tmp_dir = "tmp" + +[build] +args_bin = [] +bin = "./tmp/main" +cmd = "go build -o ./tmp/main ." +delay = 1000 +exclude_dir = ["assets", "tmp", "vendor", "testdata", "node_modules"] +exclude_file = [] +exclude_regex = ["_test.go"] +exclude_unchanged = false +follow_symlink = false +full_bin = "" +include_dir = [] +include_ext = ["go", "tpl", "tmpl", "html"] +kill_delay = "0s" +log = "build-errors.log" +send_interrupt = false +stop_on_error = true + +[color] +app = "" +build = "yellow" +main = "magenta" +runner = "green" +watcher = "cyan" + +[log] +time = false + +[misc] +clean_on_exit = false + +[screen] +clear_on_rebuild = false diff --git a/gateway/.github/workflows/release.yml b/gateway/.github/workflows/release.yml new file mode 100644 index 0000000..7e0ce96 --- /dev/null +++ b/gateway/.github/workflows/release.yml @@ -0,0 +1,24 @@ +on: + push: + tags: + - 'v*' + +jobs: + release: + permissions: + contents: write + name: Create release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Create release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + generateReleaseNotes: true + body: > + ## Changelog + + ${{ github.event.release.body }} diff --git a/gateway/.github/workflows/version.yml b/gateway/.github/workflows/version.yml new file mode 100644 index 0000000..e3019a3 --- /dev/null +++ b/gateway/.github/workflows/version.yml @@ -0,0 +1,35 @@ +name: Determine version + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + determine-version: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Get next version + id: semver + uses: ietf-tools/semver-action@v1 + with: + token: ${{ github.token }} + branch: main + - name: Create tag + uses: actions/github-script@v5 + env: + NEXT_VERSION: ${{ steps.semver.outputs.next }} + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${process.env.NEXT_VERSION}`, + sha: context.sha + }) + diff --git a/gateway/README.md b/gateway/README.md new file mode 100644 index 0000000..8b7e80c --- /dev/null +++ b/gateway/README.md @@ -0,0 +1,25 @@ +

(⌐■_■)

+ +

optique : rest api template for microservices written in go (a little opinionated)

+ +## Getting Started + +### Prerequisites + +- Go 1.18+ +- Docker +- Docker Compose + +Optional: + +- [Swaggo](https://github.com/swaggo/swag) : for generating swagger documentation +- [Migrate](https://github.com/golang-migrate/migrate) : for database migrations +- [Just](https://github.com/casey/just) : for running the application and other helpers +- [Air](https://github.com/cosmtrek/air) : for hot reloading + +### Running the application + +```bash +docker compose up -d +air +``` diff --git a/gateway/application/README.md b/gateway/application/README.md new file mode 100644 index 0000000..e69de29 diff --git a/gateway/application/application.go b/gateway/application/application.go new file mode 100644 index 0000000..dc9eb13 --- /dev/null +++ b/gateway/application/application.go @@ -0,0 +1,6 @@ +package application + +type Application interface { + Ignite() error + Stop() error +} diff --git a/gateway/application/graphql/config.go b/gateway/application/graphql/config.go new file mode 100644 index 0000000..c88bf37 --- /dev/null +++ b/gateway/application/graphql/config.go @@ -0,0 +1,5 @@ +package graphql + +type Config struct { + ListenAddr string `mapstructure:"listen_addr" env:"HTTP_LISTEN_ADDR"` +} diff --git a/gateway/application/graphql/gqlgen.yml b/gateway/application/graphql/gqlgen.yml new file mode 100644 index 0000000..811920d --- /dev/null +++ b/gateway/application/graphql/gqlgen.yml @@ -0,0 +1,159 @@ +# Where are all the schema files located? globs are supported eg src/**/*.graphqls +schema: + - graph/*.graphqls + +# Where should the generated server code go? +exec: + package: graph + layout: single-file # Only other option is "follow-schema," ie multi-file. + + # Only for single-file layout: + filename: graph/generated.go + + # Only for follow-schema layout: + # dir: graph + # filename_template: "{name}.generated.go" + + # Optional: Maximum number of goroutines in concurrency to use per child resolvers(default: unlimited) + # worker_limit: 1000 + +# Uncomment to enable federation +# federation: +# filename: graph/federation.go +# package: graph +# version: 2 +# options: +# computed_requires: true + +# Where should any generated models go? +model: + filename: graph/model/models_gen.go + package: model + + # Optional: Pass in a path to a new gotpl template to use for generating the models + # model_template: [your/path/model.gotpl] + +# Where should the resolver implementations go? +resolver: + package: graph + layout: follow-schema # Only other option is "single-file." + + # Only for single-file layout: + # filename: graph/resolver.go + + # Only for follow-schema layout: + dir: graph + filename_template: "{name}.resolvers.go" + + # Optional: turn on to not generate template comments above resolvers + # omit_template_comment: false + # Optional: Pass in a path to a new gotpl template to use for generating resolvers + # resolver_template: [your/path/resolver.gotpl] + # Optional: turn on to avoid rewriting existing resolver(s) when generating + # preserve_resolver: false + +# Optional: turn on use ` + "`" + `gqlgen:"fieldName"` + "`" + ` tags in your models +# struct_tag: json + +# Optional: turn on to use []Thing instead of []*Thing +# omit_slice_element_pointers: false + +# Optional: turn on to omit Is() methods to interface and unions +# omit_interface_checks: true + +# Optional: turn on to skip generation of ComplexityRoot struct content and Complexity function +# omit_complexity: false + +# Optional: turn on to not generate any file notice comments in generated files +# omit_gqlgen_file_notice: false + +# Optional: turn on to exclude the gqlgen version in the generated file notice. No effect if `omit_gqlgen_file_notice` is true. +# omit_gqlgen_version_in_file_notice: false + +# Optional: turn on to exclude root models such as Query and Mutation from the generated models file. +# omit_root_models: false + +# Optional: turn on to exclude resolver fields from the generated models file. +# omit_resolver_fields: false + +# Optional: turn off to make struct-type struct fields not use pointers +# e.g. type Thing struct { FieldA OtherThing } instead of { FieldA *OtherThing } +# struct_fields_always_pointers: true + +# Optional: turn off to make resolvers return values instead of pointers for structs +# resolvers_always_return_pointers: true + +# Optional: turn on to return pointers instead of values in unmarshalInput +# return_pointers_in_unmarshalinput: false + +# Optional: wrap nullable input fields with Omittable +# nullable_input_omittable: true + +# Optional: set to speed up generation time by not performing a final validation pass. +# skip_validation: true + +# Optional: set to skip running `go mod tidy` when generating server code +# skip_mod_tidy: true + +# Optional: if this is set to true, argument directives that +# decorate a field with a null value will still be called. +# +# This enables argumment directives to not just mutate +# argument values but to set them even if they're null. +call_argument_directives_with_null: true + +# This enables gql server to use function syntax for execution context +# instead of generating receiver methods of the execution context. +# use_function_syntax_for_execution_context: true + +# Optional: set build tags that will be used to load packages +# go_build_tags: +# - private +# - enterprise + +# Optional: set to modify the initialisms regarded for Go names +# go_initialisms: +# replace_defaults: false # if true, the default initialisms will get dropped in favor of the new ones instead of being added +# initialisms: # List of initialisms to for Go names +# - 'CC' +# - 'BCC' + +# gqlgen will search for any type names in the schema in these go packages +# if they match it will use them, otherwise it will generate them. +autobind: +# - "github.com/optique-dev/modules/graphql/graph/model" + +# This section declares type mapping between the GraphQL and go type systems +# +# The first line in each type will be used as defaults for resolver arguments and +# modelgen, the others will be allowed when binding to fields. Configure them to +# your liking +models: + ID: + model: + - github.com/99designs/gqlgen/graphql.ID + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + # gqlgen provides a default GraphQL UUID convenience wrapper for github.com/google/uuid + # but you can override this to provide your own GraphQL UUID implementation + UUID: + model: + - github.com/99designs/gqlgen/graphql.UUID + + # The GraphQL spec explicitly states that the Int type is a signed 32-bit + # integer. Using Go int or int64 to represent it can lead to unexpected + # behavior, and some GraphQL tools like Apollo Router will fail when + # communicating numbers that overflow 32-bits. + # + # You may choose to use the custom, built-in Int64 scalar to represent 64-bit + # integers, or ignore the spec and bind Int to graphql.Int / graphql.Int64 + # (the default behavior of gqlgen). This is fine in simple use cases when you + # do not need to worry about interoperability and only expect small numbers. + Int: + model: + - github.com/99designs/gqlgen/graphql.Int32 + Int64: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 diff --git a/gateway/application/graphql/graphql.go b/gateway/application/graphql/graphql.go new file mode 100644 index 0000000..f3e5e88 --- /dev/null +++ b/gateway/application/graphql/graphql.go @@ -0,0 +1,86 @@ +package graphql + +import ( + "context" + nethttp "net/http" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/DO-2K23-26/polypass-microservices/gateway/core" + "github.com/DO-2K23-26/polypass-microservices/gateway/graph" + "github.com/gofiber/fiber/v2" + + "github.com/valyala/fasthttp/fasthttpadaptor" +) + +type GraphQL interface { + Register(app *fiber.App) + Query() (*fiber.Ctx, error) + Playground() (*fiber.Ctx, error) +} + +type graphqlController struct { + organizationService core.OrganizationService +} + +// NewGraphQL creates a new GraphQL controller with organization and search services +func NewGraphQL(organizationService core.OrganizationService) *graphqlController { + return &graphqlController{organizationService: organizationService} +} + +func (g *graphqlController) Query() fiber.Handler { + h := handler.New(graph.NewExecutableSchema(graph.Config{ + Resolvers: &graph.Resolver{OrganizationsService: g.organizationService}, + })) + h.AddTransport(transport.Websocket{ + KeepAlivePingInterval: 10 * time.Second, + }) + h.AddTransport(transport.GET{}) + h.AddTransport(transport.POST{}) + h.AddTransport(transport.Options{}) + + // Add the introspection middleware. + h.Use(extension.Introspection{}) + + h.AroundFields(func(ctx context.Context, next graphql.Resolver) (res any, err error) { + res, err = next(ctx) + return res, err + }) + return func(ctx *fiber.Ctx) error { + wrapHandler(h.ServeHTTP)(ctx) + return nil + } + +} + +func (g *graphqlController) Playground() fiber.Handler { + return func(ctx *fiber.Ctx) error { + wrapHandler(playground.Handler("GraphQL playground", "/query"))(ctx) + return nil + } +} + +func (g *graphqlController) Register(app *fiber.App) { + app.Post("/graphql", g.Query()) + app.Get("/graphql", g.Query()) + app.Options("/graphql", g.Query()) + + + app.Post("/query", g.Query()) + app.Get("/query", g.Query()) + app.Options("/query", g.Query()) + + app.Get("/playground", g.Playground()) + app.Get("/playground", g.Playground()) +} + +// wrapHandler adapts a net/http handler to Fiber +func wrapHandler(f func(nethttp.ResponseWriter, *nethttp.Request)) func(*fiber.Ctx) { + return func(ctx *fiber.Ctx) { + fasthttpadaptor.NewFastHTTPHandler(nethttp.HandlerFunc(f))(ctx.Context()) + } +} diff --git a/gateway/application/graphql/health.go b/gateway/application/graphql/health.go new file mode 100644 index 0000000..b0d0547 --- /dev/null +++ b/gateway/application/graphql/health.go @@ -0,0 +1,28 @@ +package graphql + +import ( + "github.com/gofiber/fiber/v2" + "github.com/optique-dev/optique" +) + +type HealthController interface { + Health() fiber.Handler + Register(app *fiber.App) +} + +type healthController struct{} + +func NewHealthController() HealthController { + return healthController{} +} + +func (h healthController) Health() fiber.Handler { + return func(c *fiber.Ctx) error { + return c.SendString("Healthy") + } +} + +func (h healthController) Register(app *fiber.App) { + optique.Info("Registering health handler") + app.Get("/health", h.Health()) +} diff --git a/gateway/application/graphql/http.go b/gateway/application/graphql/http.go new file mode 100644 index 0000000..39acef4 --- /dev/null +++ b/gateway/application/graphql/http.go @@ -0,0 +1,50 @@ +package graphql + +import ( + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/cors" + "github.com/gofiber/fiber/v2/middleware/logger" +) + +type HTTP interface { + Ignite() error + Stop() error + // Add more methods here +} + +type Handler interface { + Register(app *fiber.App) +} + +type http struct { + listen_addr string + app *fiber.App + handlers []Handler +} + +func NewHttp(config Config) *http { + return &http{ + listen_addr: config.ListenAddr, + app: fiber.New(), + handlers: []Handler{}, + } +} + +func (h *http) WithHandler(handler Handler) { + h.handlers = append(h.handlers, handler) +} + +func (h *http) Ignite() error { + h.app.Use(cors.New(cors.Config{ + AllowOrigins: "*", + })) + h.app.Use(logger.New()) + for _, handler := range h.handlers { + handler.Register(h.app) + } + return h.app.Listen(h.listen_addr) +} + +func (h *http) Stop() error { + return h.app.Shutdown() +} diff --git a/gateway/application/graphql/optique-mod.json b/gateway/application/graphql/optique-mod.json new file mode 100644 index 0000000..3bb2930 --- /dev/null +++ b/gateway/application/graphql/optique-mod.json @@ -0,0 +1,12 @@ +{ + "name": "graphql", + "type": "application", + "url": "github.com/optique-dev/modules/graphql", + "ignore": [ + "go.mod", + "go.sum" + ], + "scripts": { + "genql" :"go run github.com/99designs/gqlgen generate" + } +} diff --git a/gateway/application/search/http.go b/gateway/application/search/http.go new file mode 100644 index 0000000..33ef993 --- /dev/null +++ b/gateway/application/search/http.go @@ -0,0 +1,69 @@ +// filepath: gateway/application/search/http.go +package search_http + +import ( + "strconv" + "github.com/gofiber/fiber/v2" + "github.com/DO-2K23-26/polypass-microservices/gateway/core" + pb "github.com/DO-2K23-26/polypass-microservices/gateway/proto/search" +) + +// Controller provides REST endpoints for SearchService +type Controller struct { + search core.SearchService +} + +// NewController creates a new search HTTP controller +func NewController(s core.SearchService) *Controller { + return &Controller{search: s} +} + +// Register mounts routes on the Fiber app +func (c *Controller) Register(app *fiber.App) { + app.Get("/search/folders", c.handleFolders) + app.Get("/search/tags", c.handleTags) + app.Get("/search/credentials", c.handleCredentials) +} + +// handleFolders GET /search/folders?search_query=&limit=&page=&user_id= +func (c *Controller) handleFolders(ctx *fiber.Ctx) error { + q := ctx.Query("search_query") + limit, _ := strconv.Atoi(ctx.Query("limit", "10")) + page, _ := strconv.Atoi(ctx.Query("page", "1")) + req := &pb.SearchFoldersRequest{SearchQuery: q, Limit: int32(limit), Page: int32(page), UserId: ctx.Query("user_id")} + folders, total, err := c.search.SearchFolders(ctx.Context(), req) + if err != nil { + return ctx.Status(500).JSON(fiber.Map{"error": err.Error()}) + } + return ctx.JSON(fiber.Map{"folders": folders, "total": total}) +} + +func (c *Controller) handleTags(ctx *fiber.Ctx) error { + q := ctx.Query("search_query") + limit, _ := strconv.Atoi(ctx.Query("limit", "10")) + page, _ := strconv.Atoi(ctx.Query("page", "1")) + req := &pb.SearchTagsRequest{SearchQuery: q, FolderId: ctx.Query("folder_id"), Limit: int32(limit), Page: int32(page), UserId: ctx.Query("user_id")} + tags, total, err := c.search.SearchTags(ctx.Context(), req) + if err != nil { + return ctx.Status(500).JSON(fiber.Map{"error": err.Error()}) + } + return ctx.JSON(fiber.Map{"tags": tags, "total": total}) +} + +func (c *Controller) handleCredentials(ctx *fiber.Ctx) error { + q := ctx.Query("search_query") + limit, _ := strconv.Atoi(ctx.Query("limit", "10")) + page, _ := strconv.Atoi(ctx.Query("page", "1")) + // parse tag_ids as comma-separated + tagIds := ctx.Query("tag_ids") + var tags []string + if tagIds != "" { + tags = append(tags, tagIds) + } + req := &pb.SearchCredentialsRequest{SearchQuery: q, FolderId: ctx.Query("folder_id"), TagIds: tags, Limit: int32(limit), Page: int32(page), UserId: ctx.Query("user_id")} + creds, total, err := c.search.SearchCredentials(ctx.Context(), req) + if err != nil { + return ctx.Status(500).JSON(fiber.Map{"error": err.Error()}) + } + return ctx.JSON(fiber.Map{"credentials": creds, "total": total}) +} diff --git a/gateway/application/searchhttp/http.go b/gateway/application/searchhttp/http.go new file mode 100644 index 0000000..8709cf6 --- /dev/null +++ b/gateway/application/searchhttp/http.go @@ -0,0 +1,71 @@ +// filepath: gateway/application/searchhttp/http.go +package searchhttp + +import ( + "strconv" + "strings" + + "github.com/gofiber/fiber/v2" + "github.com/DO-2K23-26/polypass-microservices/gateway/core" + pb "github.com/DO-2K23-26/polypass-microservices/gateway/proto/search" +) + +// Controller provides REST endpoints for SearchService +type Controller struct { + search core.SearchService +} + +// NewController creates a new search HTTP controller +func NewController(s core.SearchService) *Controller { + return &Controller{search: s} +} + +// Register mounts routes on the Fiber app +func (c *Controller) Register(app *fiber.App) { + app.Get("/search/folders", c.handleFolders) + app.Get("/search/tags", c.handleTags) + app.Get("/search/credentials", c.handleCredentials) +} + +// handleFolders GET /search/folders?search_query=&limit=&page=&user_id= +func (c *Controller) handleFolders(ctx *fiber.Ctx) error { + q := ctx.Query("search_query") + limit, _ := strconv.Atoi(ctx.Query("limit", "10")) + page, _ := strconv.Atoi(ctx.Query("page", "1")) + req := &pb.SearchFoldersRequest{SearchQuery: q, Limit: int32(limit), Page: int32(page), UserId: ctx.Query("user_id")} + folders, total, err := c.search.SearchFolders(ctx.Context(), req) + if err != nil { + return ctx.Status(500).JSON(fiber.Map{"error": err.Error()}) + } + return ctx.JSON(fiber.Map{"folders": folders, "total": total}) +} + +func (c *Controller) handleTags(ctx *fiber.Ctx) error { + q := ctx.Query("search_query") + limit, _ := strconv.Atoi(ctx.Query("limit", "10")) + page, _ := strconv.Atoi(ctx.Query("page", "1")) + req := &pb.SearchTagsRequest{SearchQuery: q, FolderId: ctx.Query("folder_id"), Limit: int32(limit), Page: int32(page), UserId: ctx.Query("user_id")} + tags, total, err := c.search.SearchTags(ctx.Context(), req) + if err != nil { + return ctx.Status(500).JSON(fiber.Map{"error": err.Error()}) + } + return ctx.JSON(fiber.Map{"tags": tags, "total": total}) +} + +func (c *Controller) handleCredentials(ctx *fiber.Ctx) error { + q := ctx.Query("search_query") + limit, _ := strconv.Atoi(ctx.Query("limit", "10")) + page, _ := strconv.Atoi(ctx.Query("page", "1")) + // parse tag_ids as comma-separated + tagIdsParam := ctx.Query("tag_ids") + var tagIds []string + if tagIdsParam != "" { + tagIds = strings.Split(tagIdsParam, ",") + } + req := &pb.SearchCredentialsRequest{SearchQuery: q, FolderId: ctx.Query("folder_id"), TagIds: tagIds, Limit: int32(limit), Page: int32(page), UserId: ctx.Query("user_id")} + creds, total, err := c.search.SearchCredentials(ctx.Context(), req) + if err != nil { + return ctx.Status(500).JSON(fiber.Map{"error": err.Error()}) + } + return ctx.JSON(fiber.Map{"credentials": creds, "total": total}) +} diff --git a/gateway/config.json b/gateway/config.json new file mode 100644 index 0000000..0454400 --- /dev/null +++ b/gateway/config.json @@ -0,0 +1,12 @@ +{ + "bootstrap": true, + "organizations": { + "endpoint": "http://localhost:8000" + }, + "graphql": { + "listen_addr": ":5000" + }, + "search": { + "endpoint": "localhost:50051" + } +} diff --git a/gateway/config/config.go b/gateway/config/config.go new file mode 100644 index 0000000..20d9835 --- /dev/null +++ b/gateway/config/config.go @@ -0,0 +1,54 @@ +package config + +import ( + "fmt" + + "github.com/DO-2K23-26/polypass-microservices/gateway/application/graphql" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/organizations" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/users" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/search" + "github.com/optique-dev/optique" + + "github.com/spf13/viper" +) + +type Config struct { + // Bootstrap is a flag to indicate if the application should start in bootstrap mode, meaning that the cycle should setup repositories e.g. for migrations or seeding + Bootstrap bool `mapstructure:"bootstrap"` + OrganizationConfig organizations.Config `mapstructure:"organizations"` + GraphQL graphql.Config `mapstructure:"graphql"` + Users users.UsersConfig `mapstructure:"users"` + SearchConfig search.Config `mapstructure:"search"` +} + +func LoadConfig() (*Config, error) { + viper.SetConfigName("config") + viper.AddConfigPath(".") + viper.SetConfigType("json") + viper.AutomaticEnv() + + if err := viper.ReadInConfig(); err != nil { + return nil, err + } + + var config Config + if err := viper.Unmarshal(&config); err != nil { + return nil, err + } + + return &config, nil +} + +func HandleError(err error) { + + switch err.(type) { + case viper.ConfigFileNotFoundError: + optique.Error("Config file not found") + panic(err) + case viper.ConfigParseError: + optique.Error(fmt.Sprintf("Config file parse error : %s", err.Error())) + panic(err) + default: + panic(err) + } +} diff --git a/gateway/core/organizations.go b/gateway/core/organizations.go new file mode 100644 index 0000000..85ecad3 --- /dev/null +++ b/gateway/core/organizations.go @@ -0,0 +1,105 @@ +package core + +import "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/organizations" + +type OrganizationService interface { + CreateFolder(request organizations.CreateFolderRequest) (Folder, error) + GetFolder(id string) (Folder, error) + GetFolders() ([]Folder, error) + DeleteFolder(id string) error + UpdateFolder(id string, request organizations.CreateFolderRequest) (Folder, error) +} + +type organizationsService struct { + organizationAPI organizations.OrganizationAPI +} + +func FromCreateFolderResponse(response *organizations.CreateFolderResponse) Folder { + return Folder{ + ID: response.ID, + Name: response.Name, + Description: response.Description, + Icon: response.Icon, + CreatedAt: response.CreatedAt, + UpdatedAt: response.UpdatedAt, + ParentID: response.ParentID, + CreatedBy: response.CreatedBy, + Members: response.Members, + } +} + +func FromGetFolderResponse(response *organizations.GetFolderResponse) Folder { + return Folder{ + ID: response.ID, + Name: response.Name, + Description: response.Description, + Icon: response.Icon, + CreatedAt: response.CreatedAt, + UpdatedAt: response.UpdatedAt, + ParentID: response.ParentID, + CreatedBy: response.CreatedBy, + Members: response.Members, + } +} + +func FromGetFoldersResponse(response *organizations.GetFoldersResponse) []Folder { + var folders []Folder + + for _, folder := range response.Folders { + folders = append(folders, FromGetFolderResponse(&folder)) + } + + return folders +} + +func NewOrganizationsService(organizationAPI organizations.OrganizationAPI) OrganizationService { + return &organizationsService{ + organizationAPI: organizationAPI, + } +} + +func (s *organizationsService) CreateFolder(request organizations.CreateFolderRequest) (Folder, error) { + response, err := s.organizationAPI.CreateFolder(request) + + if err != nil { + return Folder{}, err + } + + return FromCreateFolderResponse(response), nil +} + +func (s *organizationsService) GetFolder(id string) (Folder, error) { + response, err := s.organizationAPI.GetFolder(id) + + if err != nil { + return Folder{}, err + } + + return FromGetFolderResponse(response), nil +} + +func (s *organizationsService) GetFolders() ([]Folder, error) { + response, err := s.organizationAPI.GetFolders(1,100) + + if err != nil { + return []Folder{}, err + } + + return FromGetFoldersResponse(response), nil +} + +func (s *organizationsService) DeleteFolder(id string) error { + return s.organizationAPI.DeleteFolder(id) +} + +func (s *organizationsService) UpdateFolder(id string, request organizations.CreateFolderRequest) (Folder, error) { + response, err := s.organizationAPI.UpdateFolder(id, request) + + if err != nil { + return Folder{}, err + } + + return FromGetFolderResponse(response), nil +} + + diff --git a/gateway/core/search.go b/gateway/core/search.go new file mode 100644 index 0000000..4270adb --- /dev/null +++ b/gateway/core/search.go @@ -0,0 +1,48 @@ +// filepath: gateway/core/search.go +package core + +import ( + "context" + "github.com/DO-2K23-26/polypass-microservices/gateway/proto/search" +) + +// SearchService defines methods to search folders, tags, and credentials via gRPC +type SearchService interface { + SearchFolders(ctx context.Context, req *search.SearchFoldersRequest) ([]*search.Folder, int32, error) + SearchTags(ctx context.Context, req *search.SearchTagsRequest) ([]*search.Tag, int32, error) + SearchCredentials(ctx context.Context, req *search.SearchCredentialsRequest) ([]*search.Credential, int32, error) +} + +// searchService implements SearchService +type searchService struct { + client search.SearchServiceClient +} + +// NewSearchService creates a new SearchService +func NewSearchService(client search.SearchServiceClient) SearchService { + return &searchService{client: client} +} + +func (s *searchService) SearchFolders(ctx context.Context, req *search.SearchFoldersRequest) ([]*search.Folder, int32, error) { + resp, err := s.client.SearchFolders(ctx, req) + if err != nil { + return nil, 0, err + } + return resp.Folders, resp.Total, nil +} + +func (s *searchService) SearchTags(ctx context.Context, req *search.SearchTagsRequest) ([]*search.Tag, int32, error) { + resp, err := s.client.SearchTags(ctx, req) + if err != nil { + return nil, 0, err + } + return resp.Tags, resp.Total, nil +} + +func (s *searchService) SearchCredentials(ctx context.Context, req *search.SearchCredentialsRequest) ([]*search.Credential, int32, error) { + resp, err := s.client.SearchCredentials(ctx, req) + if err != nil { + return nil, 0, err + } + return resp.Credentials, resp.Total, nil +} diff --git a/gateway/core/types.go b/gateway/core/types.go new file mode 100644 index 0000000..616828e --- /dev/null +++ b/gateway/core/types.go @@ -0,0 +1,13 @@ +package core + +type Folder struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Icon string `json:"icon"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + ParentID *string `json:"parent_id"` + CreatedBy string `json:"created_by"` + Members []string `json:"members"` +} diff --git a/gateway/core/users.go b/gateway/core/users.go new file mode 100644 index 0000000..f7578ef --- /dev/null +++ b/gateway/core/users.go @@ -0,0 +1,48 @@ +package core + + +import "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/users" + + + +type User struct { + ID string `json:"id"` + Username string `json:"username"` + Email string `json:"email"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} + +type UsersService interface { + GetUser(id string) (User, error) +} + +type usersService struct { + usersAPI users.UserAPI +} + +func NewUsersService(usersAPI users.UserAPI) UsersService { + return &usersService{ + usersAPI: usersAPI, + } +} + +func (s *usersService) GetUser(id string) (User, error) { + response, err := s.usersAPI.GetUser(id) + + if err != nil { + return User{}, err + } + + return FromGetUserResponse(response), nil +} + +func FromGetUserResponse(response *users.GetUserResponse) User { + return User{ + ID: response.ID, + Username: response.Username, + Email: response.Email, + CreatedAt: response.CreatedAt, + UpdatedAt: response.UpdatedAt, + } +} diff --git a/gateway/cycle.go b/gateway/cycle.go new file mode 100644 index 0000000..7e9d732 --- /dev/null +++ b/gateway/cycle.go @@ -0,0 +1,101 @@ +package main + +import ( + "os" + "os/signal" + "syscall" + + "github.com/DO-2K23-26/polypass-microservices/gateway/application" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure" + "github.com/optique-dev/optique" +) + +// Cycle is the component in charge of the life cycle of the application +// It is responsible for starting quickly your app and shutting it down gracefully + +type Cycle interface { + Setup() error + Ignite() error + Stop() error +} + +type cycle struct { + repos []infrastructure.Repository + apps []application.Application + shutdown chan os.Signal +} + +func NewCycle() *cycle { + return &cycle{ + shutdown: make(chan os.Signal, 1), + repos: []infrastructure.Repository{}, + apps: []application.Application{}, + } +} + +func (c *cycle) AddRepository(repo infrastructure.Repository) { + c.repos = append(c.repos, repo) +} + +func (c *cycle) AddApplications(apps []application.Application) { + c.apps = append(c.apps, apps...) +} + +func (c *cycle) AddRepositories(repos []infrastructure.Repository) { + c.repos = append(c.repos, repos...) +} + +func (c *cycle) AddApplication(app application.Application) { + c.apps = append(c.apps, app) +} + +func (c *cycle) Setup() error { + if len(c.repos) == 0 { + optique.Info("No repository to setup") + return nil + } + for _, repository := range c.repos { + if err := repository.Setup(); err != nil { + return err + } + } + return nil +} + +// Ignite starts the application +func (c *cycle) Ignite() error { + if len(c.apps) == 0 { + optique.Info("No application to start") + return nil + } + + for _, app := range c.apps { + go func(app application.Application) { + err := app.Ignite() + if err != nil { + optique.Error(err.Error()) + } + }(app) + } + + signal.Notify(c.shutdown, os.Interrupt, syscall.SIGTERM) + + _ = <-c.shutdown + + _ = c.Stop() + + return nil +} + +// Stop stops the application +func (c *cycle) Stop() error { + optique.Info("Stopping applications with graceful shutdown") + close(c.shutdown) + for _, app := range c.apps { + err := app.Stop() + if err != nil { + return err + } + } + return nil +} diff --git a/gateway/docker-compose.yml b/gateway/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/gateway/go.mod b/gateway/go.mod new file mode 100644 index 0000000..0ab616c --- /dev/null +++ b/gateway/go.mod @@ -0,0 +1,49 @@ +module github.com/DO-2K23-26/polypass-microservices/gateway + +go 1.24.4 + +require ( + github.com/99designs/gqlgen v0.17.74 + github.com/gofiber/fiber/v2 v2.52.8 + github.com/optique-dev/optique v0.5.0 + github.com/spf13/viper v1.20.1 + github.com/valyala/fasthttp v1.62.0 + github.com/vektah/gqlparser/v2 v2.5.27 + google.golang.org/grpc v1.67.3 + google.golang.org/protobuf v1.36.6 + resty.dev/v3 v3.0.0-beta.3 +) + +require ( + github.com/agnivade/levenshtein v1.2.1 // indirect + github.com/andybalholm/brotli v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/gookit/color v1.5.4 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/sagikazarmark/locafero v0.7.0 // indirect + github.com/sosodev/duration v1.3.1 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.12.0 // indirect + github.com/spf13/cast v1.7.1 // indirect + github.com/spf13/pflag v1.0.6 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +require github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect diff --git a/gateway/go.sum b/gateway/go.sum new file mode 100644 index 0000000..dd63d57 --- /dev/null +++ b/gateway/go.sum @@ -0,0 +1,115 @@ +github.com/99designs/gqlgen v0.17.74 h1:1FuVtkXxOc87xpKio3f6sohREmec+Jvy86PcYOuwgWo= +github.com/99designs/gqlgen v0.17.74/go.mod h1:a+iR6mfRLNRp++kDpooFHiPWYiWX3Yu1BIilQRHgh10= +github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo= +github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y= +github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= +github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= +github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= +github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gofiber/fiber/v2 v2.52.8 h1:xl4jJQ0BV5EJTA2aWiKw/VddRpHrKeZLF0QPUxqn0x4= +github.com/gofiber/fiber/v2 v2.52.8/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= +github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/optique-dev/optique v0.5.0 h1:QVAHawZrOC7qTXQg3Pg4T/7CTLhCITjm9qMjfDSCkIs= +github.com/optique-dev/optique v0.5.0/go.mod h1:YFgCB+ScD91LGSzIZPRzRLfPSvq9TXZIfyj/8D1YoXc= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= +github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= +github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= +github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= +github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= +github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= +github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.62.0 h1:8dKRBX/y2rCzyc6903Zu1+3qN0H/d2MsxPPmVNamiH0= +github.com/valyala/fasthttp v1.62.0/go.mod h1:FCINgr4GKdKqV8Q0xv8b+UxPV+H/O5nNFo3D+r54Htg= +github.com/vektah/gqlparser/v2 v2.5.27 h1:RHPD3JOplpk5mP5JGX8RKZkt2/Vwj/PZv0HxTdwFp0s= +github.com/vektah/gqlparser/v2 v2.5.27/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= +github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= +github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= +google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +resty.dev/v3 v3.0.0-beta.3 h1:3kEwzEgCnnS6Ob4Emlk94t+I/gClyoah7SnNi67lt+E= +resty.dev/v3 v3.0.0-beta.3/go.mod h1:OgkqiPvTDtOuV4MGZuUDhwOpkY8enjOsjjMzeOHefy4= diff --git a/gateway/gqlgen.yml b/gateway/gqlgen.yml new file mode 100644 index 0000000..9296641 --- /dev/null +++ b/gateway/gqlgen.yml @@ -0,0 +1,178 @@ +# Where are all the schema files located? globs are supported eg src/**/*.graphqls +schema: + - graph/*.graphqls + +# Where should the generated server code go? +exec: + package: graph + layout: single-file # Only other option is "follow-schema," ie multi-file. + + # Only for single-file layout: + filename: graph/generated.go + + # Only for follow-schema layout: + # dir: graph + # filename_template: "{name}.generated.go" + + # Optional: Maximum number of goroutines in concurrency to use per child resolvers(default: unlimited) + # worker_limit: 1000 + +# Uncomment to enable federation +# federation: +# filename: graph/federation.go +# package: graph +# version: 2 +# options: +# computed_requires: true + +# Where should any generated models go? +model: + filename: graph/model/models_gen.go + package: model + + # Optional: Pass in a path to a new gotpl template to use for generating the models + # model_template: [your/path/model.gotpl] + +# Where should the resolver implementations go? +resolver: + package: graph + layout: follow-schema # Only other option is "single-file." + + # Only for single-file layout: + # filename: graph/resolver.go + + # Only for follow-schema layout: + dir: graph + filename_template: "{name}.resolvers.go" + + # Optional: turn on to not generate template comments above resolvers + # omit_template_comment: false + # Optional: Pass in a path to a new gotpl template to use for generating resolvers + # resolver_template: [your/path/resolver.gotpl] + # Optional: turn on to avoid rewriting existing resolver(s) when generating + # preserve_resolver: false + +# Optional: turn on use ` + "`" + `gqlgen:"fieldName"` + "`" + ` tags in your models +# struct_tag: json + +# Optional: turn on to use []Thing instead of []*Thing +# omit_slice_element_pointers: false + +# Optional: turn on to omit Is() methods to interface and unions +# omit_interface_checks: true + +# Optional: turn on to skip generation of ComplexityRoot struct content and Complexity function +# omit_complexity: false + +# Optional: turn on to not generate any file notice comments in generated files +# omit_gqlgen_file_notice: false + +# Optional: turn on to exclude the gqlgen version in the generated file notice. No effect if `omit_gqlgen_file_notice` is true. +# omit_gqlgen_version_in_file_notice: false + +# Optional: turn on to exclude root models such as Query and Mutation from the generated models file. +# omit_root_models: false + +# Optional: turn on to exclude resolver fields from the generated models file. +# omit_resolver_fields: false + +# Optional: turn off to make struct-type struct fields not use pointers +# e.g. type Thing struct { FieldA OtherThing } instead of { FieldA *OtherThing } +# struct_fields_always_pointers: true + +# Optional: turn off to make resolvers return values instead of pointers for structs +# resolvers_always_return_pointers: true + +# Optional: turn on to return pointers instead of values in unmarshalInput +# return_pointers_in_unmarshalinput: false + +# Optional: wrap nullable input fields with Omittable +# nullable_input_omittable: true + +# Optional: set to speed up generation time by not performing a final validation pass. +# skip_validation: true + +# Optional: set to skip running `go mod tidy` when generating server code +# skip_mod_tidy: true + +# Optional: if this is set to true, argument directives that +# decorate a field with a null value will still be called. +# +# This enables argumment directives to not just mutate +# argument values but to set them even if they're null. +call_argument_directives_with_null: true + +# This enables gql server to use function syntax for execution context +# instead of generating receiver methods of the execution context. +# use_function_syntax_for_execution_context: true + +# Optional: set build tags that will be used to load packages +# go_build_tags: +# - private +# - enterprise + +# Optional: set to modify the initialisms regarded for Go names +# go_initialisms: +# replace_defaults: false # if true, the default initialisms will get dropped in favor of the new ones instead of being added +# initialisms: # List of initialisms to for Go names +# - 'CC' +# - 'BCC' + +# gqlgen will search for any type names in the schema in these go packages +# if they match it will use them, otherwise it will generate them. +autobind: +# - "github.com/Courtcircuits/tp-microservices/communication/api-gateway/graph/model" + +# This section declares type mapping between the GraphQL and go type systems +# +# The first line in each type will be used as defaults for resolver arguments and +# modelgen, the others will be allowed when binding to fields. Configure them to +# your liking +models: + PasswordCredential: + SSHCredential: + CardCredential: + Folder: + fields: + tags: + resolver: true + members: + resolver: true + createdBy: + resolver: true + parent: + resolver: true + Tag: + fields: + folder: + resolver: true + createdBy: + resolver: true + ID: + model: + - github.com/99designs/gqlgen/graphql.ID + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + # gqlgen provides a default GraphQL UUID convenience wrapper for github.com/google/uuid + # but you can override this to provide your own GraphQL UUID implementation + UUID: + model: + - github.com/99designs/gqlgen/graphql.UUID + + # The GraphQL spec explicitly states that the Int type is a signed 32-bit + # integer. Using Go int or int64 to represent it can lead to unexpected + # behavior, and some GraphQL tools like Apollo Router will fail when + # communicating numbers that overflow 32-bits. + # + # You may choose to use the custom, built-in Int64 scalar to represent 64-bit + # integers, or ignore the spec and bind Int to graphql.Int / graphql.Int64 + # (the default behavior of gqlgen). This is fine in simple use cases when you + # do not need to worry about interoperability and only expect small numbers. + Int: + model: + - github.com/99designs/gqlgen/graphql.Int32 + Int64: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 diff --git a/gateway/graph/folders.go b/gateway/graph/folders.go new file mode 100644 index 0000000..660f617 --- /dev/null +++ b/gateway/graph/folders.go @@ -0,0 +1,18 @@ +package graph + +import ( + "github.com/DO-2K23-26/polypass-microservices/gateway/core" + + model1 "github.com/DO-2K23-26/polypass-microservices/gateway/graph/model" +) + +func FolderToModel(folder *core.Folder) *model1.Folder { + return &model1.Folder{ + ID: folder.ID, + Name: folder.Name, + Description: folder.Description, + Icon: folder.Icon, + CreatedAt: folder.CreatedAt, + UpdatedAt: folder.UpdatedAt, + } +} diff --git a/gateway/graph/generated.go b/gateway/graph/generated.go new file mode 100644 index 0000000..a120609 --- /dev/null +++ b/gateway/graph/generated.go @@ -0,0 +1,8841 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package graph + +import ( + "bytes" + "context" + "embed" + "errors" + "fmt" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + "github.com/DO-2K23-26/polypass-microservices/gateway/graph/model" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +// Add stub Complexity method to satisfy executableSchema interface +func (e *executableSchema) Complexity(ctx context.Context, typeName string, fieldName string, childComplexity int, args map[string]any) (int, bool) { + // default to no custom complexity + return childComplexity, false +} + +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Folder() FolderResolver + Mutation() MutationResolver + Query() QueryResolver + Tag() TagResolver +} + +type DirectiveRoot struct { +} + +type ComplexityRoot struct { + CardCredential struct { + CardNumber func(childComplexity int) int + CreatedAt func(childComplexity int) int + CustomFields func(childComplexity int) int + Cvc func(childComplexity int) int + ExpirationDate func(childComplexity int) int + ExpiresAt func(childComplexity int) int + ID func(childComplexity int) int + LastReadAt func(childComplexity int) int + Note func(childComplexity int) int + OwnerName func(childComplexity int) int + Title func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UserIdentifier func(childComplexity int) int + } + + Folder struct { + CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int + Description func(childComplexity int) int + ID func(childComplexity int) int + Icon func(childComplexity int) int + Members func(childComplexity int) int + Name func(childComplexity int) int + Parent func(childComplexity int) int + Tags func(childComplexity int) int + UpdatedAt func(childComplexity int) int + } + + Mutation struct { + CreateFolder func(childComplexity int, newFolder model.NewFolder) int + DeleteFolder func(childComplexity int, id string) int + } + + PasswordCredential struct { + CreatedAt func(childComplexity int) int + CustomFields func(childComplexity int) int + DomainName func(childComplexity int) int + ExpiresAt func(childComplexity int) int + ID func(childComplexity int) int + LastReadAt func(childComplexity int) int + Note func(childComplexity int) int + Password func(childComplexity int) int + Title func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UserIdentifier func(childComplexity int) int + } + + Query struct { + Credentials func(childComplexity int) int + Folders func(childComplexity int) int + SearchCredentials func(childComplexity int, searchQuery string, folderID *string, tagIds []string, limit int32, page int32, userID string) int + SearchFolders func(childComplexity int, searchQuery string, limit int32, page int32, userID string) int + SearchTags func(childComplexity int, searchQuery string, folderID string, limit int32, page int32, userID string) int + Tags func(childComplexity int) int + } + + SSHCredential struct { + CreatedAt func(childComplexity int) int + CustomFields func(childComplexity int) int + ExpiresAt func(childComplexity int) int + Hostname func(childComplexity int) int + ID func(childComplexity int) int + LastReadAt func(childComplexity int) int + Note func(childComplexity int) int + PrivateKey func(childComplexity int) int + PublicKey func(childComplexity int) int + Title func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UserIdentifier func(childComplexity int) int + } + + SearchCredentialsResponse struct { + Credentials func(childComplexity int) int + Total func(childComplexity int) int + } + + SearchFoldersResponse struct { + Folders func(childComplexity int) int + Total func(childComplexity int) int + } + + SearchTagsResponse struct { + Tags func(childComplexity int) int + Total func(childComplexity int) int + } + + Tag struct { + Color func(childComplexity int) int + CreatedBy func(childComplexity int) int + Folder func(childComplexity int) int + Name func(childComplexity int) int + } + + User struct { + Email func(childComplexity int) int + ID func(childComplexity int) int + Username func(childComplexity int) int + } +} + +type FolderResolver interface { + Parent(ctx context.Context, obj *model.Folder) (*model.Folder, error) + CreatedBy(ctx context.Context, obj *model.Folder) (*model.User, error) + + Members(ctx context.Context, obj *model.Folder) ([]*model.User, error) + Tags(ctx context.Context, obj *model.Folder) ([]*model.Tag, error) +} +type MutationResolver interface { + CreateFolder(ctx context.Context, newFolder model.NewFolder) (*model.Folder, error) + DeleteFolder(ctx context.Context, id string) (bool, error) +} +type QueryResolver interface { + Credentials(ctx context.Context) ([]model.Credential, error) + Folders(ctx context.Context) ([]*model.Folder, error) + Tags(ctx context.Context) ([]*model.Tag, error) + SearchFolders(ctx context.Context, searchQuery string, limit int32, page int32, userID string) (*model.SearchFoldersResponse, error) + SearchTags(ctx context.Context, searchQuery string, folderID string, limit int32, page int32, userID string) (*model.SearchTagsResponse, error) + SearchCredentials(ctx context.Context, searchQuery string, folderID *string, tagIds []string, limit int32, page int32, userID string) (*model.SearchCredentialsResponse, error) +} +type TagResolver interface { + Folder(ctx context.Context, obj *model.Tag) (*model.Folder, error) + CreatedBy(ctx context.Context, obj *model.Tag) (*model.User, error) +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]any) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "CardCredential.cardNumber": + if e.complexity.CardCredential.CardNumber == nil { + break + } + + return e.complexity.CardCredential.CardNumber(childComplexity), true + + case "CardCredential.createdAt": + if e.complexity.CardCredential.CreatedAt == nil { + break + } + + return e.complexity.CardCredential.CreatedAt(childComplexity), true + + case "CardCredential.customFields": + if e.complexity.CardCredential.CustomFields == nil { + break + } + + return e.complexity.CardCredential.CustomFields(childComplexity), true + + case "CardCredential.CVC": + if e.complexity.CardCredential.Cvc == nil { + break + } + + return e.complexity.CardCredential.Cvc(childComplexity), true + + case "CardCredential.expirationDate": + if e.complexity.CardCredential.ExpirationDate == nil { + break + } + + return e.complexity.CardCredential.ExpirationDate(childComplexity), true + + case "CardCredential.expiresAt": + if e.complexity.CardCredential.ExpiresAt == nil { + break + } + + return e.complexity.CardCredential.ExpiresAt(childComplexity), true + + case "CardCredential.id": + if e.complexity.CardCredential.ID == nil { + break + } + + return e.complexity.CardCredential.ID(childComplexity), true + + case "CardCredential.lastReadAt": + if e.complexity.CardCredential.LastReadAt == nil { + break + } + + return e.complexity.CardCredential.LastReadAt(childComplexity), true + + case "CardCredential.note": + if e.complexity.CardCredential.Note == nil { + break + } + + return e.complexity.CardCredential.Note(childComplexity), true + + case "CardCredential.ownerName": + if e.complexity.CardCredential.OwnerName == nil { + break + } + + return e.complexity.CardCredential.OwnerName(childComplexity), true + + case "CardCredential.title": + if e.complexity.CardCredential.Title == nil { + break + } + + return e.complexity.CardCredential.Title(childComplexity), true + + case "CardCredential.updatedAt": + if e.complexity.CardCredential.UpdatedAt == nil { + break + } + + return e.complexity.CardCredential.UpdatedAt(childComplexity), true + + case "CardCredential.userIdentifier": + if e.complexity.CardCredential.UserIdentifier == nil { + break + } + + return e.complexity.CardCredential.UserIdentifier(childComplexity), true + + case "Folder.createdAt": + if e.complexity.Folder.CreatedAt == nil { + break + } + + return e.complexity.Folder.CreatedAt(childComplexity), true + + case "Folder.createdBy": + if e.complexity.Folder.CreatedBy == nil { + break + } + + return e.complexity.Folder.CreatedBy(childComplexity), true + + case "Folder.description": + if e.complexity.Folder.Description == nil { + break + } + + return e.complexity.Folder.Description(childComplexity), true + + case "Folder.id": + if e.complexity.Folder.ID == nil { + break + } + + return e.complexity.Folder.ID(childComplexity), true + + case "Folder.icon": + if e.complexity.Folder.Icon == nil { + break + } + + return e.complexity.Folder.Icon(childComplexity), true + + case "Folder.members": + if e.complexity.Folder.Members == nil { + break + } + + return e.complexity.Folder.Members(childComplexity), true + + case "Folder.name": + if e.complexity.Folder.Name == nil { + break + } + + return e.complexity.Folder.Name(childComplexity), true + + case "Folder.parent": + if e.complexity.Folder.Parent == nil { + break + } + + return e.complexity.Folder.Parent(childComplexity), true + + case "Folder.tags": + if e.complexity.Folder.Tags == nil { + break + } + + return e.complexity.Folder.Tags(childComplexity), true + + case "Folder.updatedAt": + if e.complexity.Folder.UpdatedAt == nil { + break + } + + return e.complexity.Folder.UpdatedAt(childComplexity), true + + case "Mutation.createFolder": + if e.complexity.Mutation.CreateFolder == nil { + break + } + + args, err := ec.field_Mutation_createFolder_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateFolder(childComplexity, args["newFolder"].(model.NewFolder)), true + + case "Mutation.deleteFolder": + if e.complexity.Mutation.DeleteFolder == nil { + break + } + + args, err := ec.field_Mutation_deleteFolder_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteFolder(childComplexity, args["id"].(string)), true + + case "PasswordCredential.createdAt": + if e.complexity.PasswordCredential.CreatedAt == nil { + break + } + + return e.complexity.PasswordCredential.CreatedAt(childComplexity), true + + case "PasswordCredential.customFields": + if e.complexity.PasswordCredential.CustomFields == nil { + break + } + + return e.complexity.PasswordCredential.CustomFields(childComplexity), true + + case "PasswordCredential.domainName": + if e.complexity.PasswordCredential.DomainName == nil { + break + } + + return e.complexity.PasswordCredential.DomainName(childComplexity), true + + case "PasswordCredential.expiresAt": + if e.complexity.PasswordCredential.ExpiresAt == nil { + break + } + + return e.complexity.PasswordCredential.ExpiresAt(childComplexity), true + + case "PasswordCredential.id": + if e.complexity.PasswordCredential.ID == nil { + break + } + + return e.complexity.PasswordCredential.ID(childComplexity), true + + case "PasswordCredential.lastReadAt": + if e.complexity.PasswordCredential.LastReadAt == nil { + break + } + + return e.complexity.PasswordCredential.LastReadAt(childComplexity), true + + case "PasswordCredential.note": + if e.complexity.PasswordCredential.Note == nil { + break + } + + return e.complexity.PasswordCredential.Note(childComplexity), true + + case "PasswordCredential.password": + if e.complexity.PasswordCredential.Password == nil { + break + } + + return e.complexity.PasswordCredential.Password(childComplexity), true + + case "PasswordCredential.title": + if e.complexity.PasswordCredential.Title == nil { + break + } + + return e.complexity.PasswordCredential.Title(childComplexity), true + + case "PasswordCredential.updatedAt": + if e.complexity.PasswordCredential.UpdatedAt == nil { + break + } + + return e.complexity.PasswordCredential.UpdatedAt(childComplexity), true + + case "PasswordCredential.userIdentifier": + if e.complexity.PasswordCredential.UserIdentifier == nil { + break + } + + return e.complexity.PasswordCredential.UserIdentifier(childComplexity), true + + case "Query.credentials": + if e.complexity.Query.Credentials == nil { + break + } + + return e.complexity.Query.Credentials(childComplexity), true + + case "Query.folders": + if e.complexity.Query.Folders == nil { + break + } + + return e.complexity.Query.Folders(childComplexity), true + + case "Query.searchCredentials": + if e.complexity.Query.SearchCredentials == nil { + break + } + + args, err := ec.field_Query_searchCredentials_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.SearchCredentials(childComplexity, args["searchQuery"].(string), args["folderId"].(*string), args["tagIds"].([]string), args["limit"].(int32), args["page"].(int32), args["userId"].(string)), true + + case "Query.searchFolders": + if e.complexity.Query.SearchFolders == nil { + break + } + + args, err := ec.field_Query_searchFolders_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.SearchFolders(childComplexity, args["searchQuery"].(string), args["limit"].(int32), args["page"].(int32), args["userId"].(string)), true + + case "Query.searchTags": + if e.complexity.Query.SearchTags == nil { + break + } + + args, err := ec.field_Query_searchTags_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.SearchTags(childComplexity, args["searchQuery"].(string), args["folderId"].(string), args["limit"].(int32), args["page"].(int32), args["userId"].(string)), true + + case "Query.tags": + if e.complexity.Query.Tags == nil { + break + } + + return e.complexity.Query.Tags(childComplexity), true + + case "SSHCredential.createdAt": + if e.complexity.SSHCredential.CreatedAt == nil { + break + } + + return e.complexity.SSHCredential.CreatedAt(childComplexity), true + + case "SSHCredential.customFields": + if e.complexity.SSHCredential.CustomFields == nil { + break + } + + return e.complexity.SSHCredential.CustomFields(childComplexity), true + + case "SSHCredential.expiresAt": + if e.complexity.SSHCredential.ExpiresAt == nil { + break + } + + return e.complexity.SSHCredential.ExpiresAt(childComplexity), true + + case "SSHCredential.hostname": + if e.complexity.SSHCredential.Hostname == nil { + break + } + + return e.complexity.SSHCredential.Hostname(childComplexity), true + + case "SSHCredential.id": + if e.complexity.SSHCredential.ID == nil { + break + } + + return e.complexity.SSHCredential.ID(childComplexity), true + + case "SSHCredential.lastReadAt": + if e.complexity.SSHCredential.LastReadAt == nil { + break + } + + return e.complexity.SSHCredential.LastReadAt(childComplexity), true + + case "SSHCredential.note": + if e.complexity.SSHCredential.Note == nil { + break + } + + return e.complexity.SSHCredential.Note(childComplexity), true + + case "SSHCredential.privateKey": + if e.complexity.SSHCredential.PrivateKey == nil { + break + } + + return e.complexity.SSHCredential.PrivateKey(childComplexity), true + + case "SSHCredential.publicKey": + if e.complexity.SSHCredential.PublicKey == nil { + break + } + + return e.complexity.SSHCredential.PublicKey(childComplexity), true + + case "SSHCredential.title": + if e.complexity.SSHCredential.Title == nil { + break + } + + return e.complexity.SSHCredential.Title(childComplexity), true + + case "SSHCredential.updatedAt": + if e.complexity.SSHCredential.UpdatedAt == nil { + break + } + + return e.complexity.SSHCredential.UpdatedAt(childComplexity), true + + case "SSHCredential.userIdentifier": + if e.complexity.SSHCredential.UserIdentifier == nil { + break + } + + return e.complexity.SSHCredential.UserIdentifier(childComplexity), true + + case "SearchCredentialsResponse.credentials": + if e.complexity.SearchCredentialsResponse.Credentials == nil { + break + } + + return e.complexity.SearchCredentialsResponse.Credentials(childComplexity), true + + case "SearchCredentialsResponse.total": + if e.complexity.SearchCredentialsResponse.Total == nil { + break + } + + return e.complexity.SearchCredentialsResponse.Total(childComplexity), true + + case "SearchFoldersResponse.folders": + if e.complexity.SearchFoldersResponse.Folders == nil { + break + } + + return e.complexity.SearchFoldersResponse.Folders(childComplexity), true + + case "SearchFoldersResponse.total": + if e.complexity.SearchFoldersResponse.Total == nil { + break + } + + return e.complexity.SearchFoldersResponse.Total(childComplexity), true + + case "SearchTagsResponse.tags": + if e.complexity.SearchTagsResponse.Tags == nil { + break + } + + return e.complexity.SearchTagsResponse.Tags(childComplexity), true + + case "SearchTagsResponse.total": + if e.complexity.SearchTagsResponse.Total == nil { + break + } + + return e.complexity.SearchTagsResponse.Total(childComplexity), true + + case "Tag.color": + if e.complexity.Tag.Color == nil { + break + } + + return e.complexity.Tag.Color(childComplexity), true + + case "Tag.createdBy": + if e.complexity.Tag.CreatedBy == nil { + break + } + + return e.complexity.Tag.CreatedBy(childComplexity), true + + case "Tag.folder": + if e.complexity.Tag.Folder == nil { + break + } + + return e.complexity.Tag.Folder(childComplexity), true + + case "Tag.name": + if e.complexity.Tag.Name == nil { + break + } + + return e.complexity.Tag.Name(childComplexity), true + + case "User.email": + if e.complexity.User.Email == nil { + break + } + + return e.complexity.User.Email(childComplexity), true + + case "User.id": + if e.complexity.User.ID == nil { + break + } + + return e.complexity.User.ID(childComplexity), true + + case "User.username": + if e.complexity.User.Username == nil { + break + } + + return e.complexity.User.Username(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputNewFolder, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +//go:embed "schema.graphqls" +var sourcesFS embed.FS + +func sourceData(filename string) string { + data, err := sourcesFS.ReadFile(filename) + if err != nil { + panic(fmt.Sprintf("codegen problem: %s not available", filename)) + } + return string(data) +} + +var sources = []*ast.Source{ + {Name: "schema.graphqls", Input: sourceData("schema.graphqls"), BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_Mutation_createFolder_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_createFolder_argsNewFolder(ctx, rawArgs) + if err != nil { + return nil, err + } + args["newFolder"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_createFolder_argsNewFolder( + ctx context.Context, + rawArgs map[string]any, +) (model.NewFolder, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("newFolder")) + if tmp, ok := rawArgs["newFolder"]; ok { + return ec.unmarshalNNewFolder2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐNewFolder(ctx, tmp) + } + + var zeroVal model.NewFolder + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_deleteFolder_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_deleteFolder_argsID(ctx, rawArgs) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_deleteFolder_argsID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func (ec *executionContext) field_Query___type_argsName( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchCredentials_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_searchCredentials_argsSearchQuery(ctx, rawArgs) + if err != nil { + return nil, err + } + args["searchQuery"] = arg0 + arg1, err := ec.field_Query_searchCredentials_argsFolderID(ctx, rawArgs) + if err != nil { + return nil, err + } + args["folderId"] = arg1 + arg2, err := ec.field_Query_searchCredentials_argsTagIds(ctx, rawArgs) + if err != nil { + return nil, err + } + args["tagIds"] = arg2 + arg3, err := ec.field_Query_searchCredentials_argsLimit(ctx, rawArgs) + if err != nil { + return nil, err + } + args["limit"] = arg3 + arg4, err := ec.field_Query_searchCredentials_argsPage(ctx, rawArgs) + if err != nil { + return nil, err + } + args["page"] = arg4 + arg5, err := ec.field_Query_searchCredentials_argsUserID(ctx, rawArgs) + if err != nil { + return nil, err + } + args["userId"] = arg5 + return args, nil +} +func (ec *executionContext) field_Query_searchCredentials_argsSearchQuery( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("searchQuery")) + if tmp, ok := rawArgs["searchQuery"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchCredentials_argsFolderID( + ctx context.Context, + rawArgs map[string]any, +) (*string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("folderId")) + if tmp, ok := rawArgs["folderId"]; ok { + return ec.unmarshalOID2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchCredentials_argsTagIds( + ctx context.Context, + rawArgs map[string]any, +) ([]string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("tagIds")) + if tmp, ok := rawArgs["tagIds"]; ok { + return ec.unmarshalOID2ᚕstringᚄ(ctx, tmp) + } + + var zeroVal []string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchCredentials_argsLimit( + ctx context.Context, + rawArgs map[string]any, +) (int32, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + if tmp, ok := rawArgs["limit"]; ok { + return ec.unmarshalNInt2int32(ctx, tmp) + } + + var zeroVal int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchCredentials_argsPage( + ctx context.Context, + rawArgs map[string]any, +) (int32, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("page")) + if tmp, ok := rawArgs["page"]; ok { + return ec.unmarshalNInt2int32(ctx, tmp) + } + + var zeroVal int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchCredentials_argsUserID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) + if tmp, ok := rawArgs["userId"]; ok { + return ec.unmarshalNID2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchFolders_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_searchFolders_argsSearchQuery(ctx, rawArgs) + if err != nil { + return nil, err + } + args["searchQuery"] = arg0 + arg1, err := ec.field_Query_searchFolders_argsLimit(ctx, rawArgs) + if err != nil { + return nil, err + } + args["limit"] = arg1 + arg2, err := ec.field_Query_searchFolders_argsPage(ctx, rawArgs) + if err != nil { + return nil, err + } + args["page"] = arg2 + arg3, err := ec.field_Query_searchFolders_argsUserID(ctx, rawArgs) + if err != nil { + return nil, err + } + args["userId"] = arg3 + return args, nil +} +func (ec *executionContext) field_Query_searchFolders_argsSearchQuery( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("searchQuery")) + if tmp, ok := rawArgs["searchQuery"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchFolders_argsLimit( + ctx context.Context, + rawArgs map[string]any, +) (int32, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + if tmp, ok := rawArgs["limit"]; ok { + return ec.unmarshalNInt2int32(ctx, tmp) + } + + var zeroVal int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchFolders_argsPage( + ctx context.Context, + rawArgs map[string]any, +) (int32, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("page")) + if tmp, ok := rawArgs["page"]; ok { + return ec.unmarshalNInt2int32(ctx, tmp) + } + + var zeroVal int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchFolders_argsUserID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) + if tmp, ok := rawArgs["userId"]; ok { + return ec.unmarshalNID2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchTags_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_searchTags_argsSearchQuery(ctx, rawArgs) + if err != nil { + return nil, err + } + args["searchQuery"] = arg0 + arg1, err := ec.field_Query_searchTags_argsFolderID(ctx, rawArgs) + if err != nil { + return nil, err + } + args["folderId"] = arg1 + arg2, err := ec.field_Query_searchTags_argsLimit(ctx, rawArgs) + if err != nil { + return nil, err + } + args["limit"] = arg2 + arg3, err := ec.field_Query_searchTags_argsPage(ctx, rawArgs) + if err != nil { + return nil, err + } + args["page"] = arg3 + arg4, err := ec.field_Query_searchTags_argsUserID(ctx, rawArgs) + if err != nil { + return nil, err + } + args["userId"] = arg4 + return args, nil +} +func (ec *executionContext) field_Query_searchTags_argsSearchQuery( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("searchQuery")) + if tmp, ok := rawArgs["searchQuery"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchTags_argsFolderID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("folderId")) + if tmp, ok := rawArgs["folderId"]; ok { + return ec.unmarshalNID2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchTags_argsLimit( + ctx context.Context, + rawArgs map[string]any, +) (int32, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + if tmp, ok := rawArgs["limit"]; ok { + return ec.unmarshalNInt2int32(ctx, tmp) + } + + var zeroVal int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchTags_argsPage( + ctx context.Context, + rawArgs map[string]any, +) (int32, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("page")) + if tmp, ok := rawArgs["page"]; ok { + return ec.unmarshalNInt2int32(ctx, tmp) + } + + var zeroVal int32 + return zeroVal, nil +} + +func (ec *executionContext) field_Query_searchTags_argsUserID( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) + if tmp, ok := rawArgs["userId"]; ok { + return ec.unmarshalNID2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Directive_args_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Directive_args_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Field_args_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Field_args_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _CardCredential_cardNumber(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_cardNumber(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CardNumber, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_cardNumber(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_customFields(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_customFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CustomFields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOJSON2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_customFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type JSON does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_CVC(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_CVC(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cvc, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_CVC(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_expirationDate(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_expirationDate(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpirationDate, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_expirationDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_expiresAt(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_expiresAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpiresAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_id(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_lastReadAt(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_lastReadAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastReadAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_lastReadAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_note(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_note(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Note, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_note(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_ownerName(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_ownerName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.OwnerName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_ownerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_title(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_updatedAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CardCredential_userIdentifier(ctx context.Context, field graphql.CollectedField, obj *model.CardCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CardCredential_userIdentifier(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserIdentifier, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CardCredential_userIdentifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CardCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_id(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_name(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_description(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_icon(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_icon(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Icon, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_icon(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_parent(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_parent(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Folder().Parent(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Folder) + fc.Result = res + return ec.marshalOFolder2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_parent(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Folder_id(ctx, field) + case "name": + return ec.fieldContext_Folder_name(ctx, field) + case "description": + return ec.fieldContext_Folder_description(ctx, field) + case "icon": + return ec.fieldContext_Folder_icon(ctx, field) + case "parent": + return ec.fieldContext_Folder_parent(ctx, field) + case "createdBy": + return ec.fieldContext_Folder_createdBy(ctx, field) + case "createdAt": + return ec.fieldContext_Folder_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Folder_updatedAt(ctx, field) + case "members": + return ec.fieldContext_Folder_members(ctx, field) + case "tags": + return ec.fieldContext_Folder_tags(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Folder", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_createdBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Folder().CreatedBy(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalNUser2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_createdBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "username": + return ec.fieldContext_User_username(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_updatedAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_members(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_members(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Folder().Members(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.User) + fc.Result = res + return ec.marshalNUser2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_members(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "username": + return ec.fieldContext_User_username(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Folder_tags(ctx context.Context, field graphql.CollectedField, obj *model.Folder) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Folder_tags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Folder().Tags(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Tag) + fc.Result = res + return ec.marshalOTag2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTagᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Folder_tags(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Folder", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Tag_name(ctx, field) + case "color": + return ec.fieldContext_Tag_color(ctx, field) + case "folder": + return ec.fieldContext_Tag_folder(ctx, field) + case "createdBy": + return ec.fieldContext_Tag_createdBy(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tag", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createFolder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createFolder(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateFolder(rctx, fc.Args["newFolder"].(model.NewFolder)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Folder) + fc.Result = res + return ec.marshalNFolder2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createFolder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Folder_id(ctx, field) + case "name": + return ec.fieldContext_Folder_name(ctx, field) + case "description": + return ec.fieldContext_Folder_description(ctx, field) + case "icon": + return ec.fieldContext_Folder_icon(ctx, field) + case "parent": + return ec.fieldContext_Folder_parent(ctx, field) + case "createdBy": + return ec.fieldContext_Folder_createdBy(ctx, field) + case "createdAt": + return ec.fieldContext_Folder_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Folder_updatedAt(ctx, field) + case "members": + return ec.fieldContext_Folder_members(ctx, field) + case "tags": + return ec.fieldContext_Folder_tags(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Folder", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createFolder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteFolder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteFolder(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteFolder(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteFolder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteFolder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_expiresAt(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_expiresAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpiresAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_updatedAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_lastReadAt(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_lastReadAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastReadAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_lastReadAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_note(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_note(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Note, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_note(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_password(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_password(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Password, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_password(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_title(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_userIdentifier(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_userIdentifier(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserIdentifier, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_userIdentifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_id(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_domainName(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_domainName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DomainName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_domainName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PasswordCredential_customFields(ctx context.Context, field graphql.CollectedField, obj *model.PasswordCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PasswordCredential_customFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CustomFields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOJSON2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PasswordCredential_customFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PasswordCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type JSON does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_credentials(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_credentials(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Credentials(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.Credential) + fc.Result = res + return ec.marshalNCredential2ᚕgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐCredentialᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_credentials(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Credential does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_folders(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_folders(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Folders(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Folder) + fc.Result = res + return ec.marshalNFolder2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolderᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_folders(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Folder_id(ctx, field) + case "name": + return ec.fieldContext_Folder_name(ctx, field) + case "description": + return ec.fieldContext_Folder_description(ctx, field) + case "icon": + return ec.fieldContext_Folder_icon(ctx, field) + case "parent": + return ec.fieldContext_Folder_parent(ctx, field) + case "createdBy": + return ec.fieldContext_Folder_createdBy(ctx, field) + case "createdAt": + return ec.fieldContext_Folder_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Folder_updatedAt(ctx, field) + case "members": + return ec.fieldContext_Folder_members(ctx, field) + case "tags": + return ec.fieldContext_Folder_tags(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Folder", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_tags(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_tags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Tags(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Tag) + fc.Result = res + return ec.marshalNTag2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTagᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_tags(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Tag_name(ctx, field) + case "color": + return ec.fieldContext_Tag_color(ctx, field) + case "folder": + return ec.fieldContext_Tag_folder(ctx, field) + case "createdBy": + return ec.fieldContext_Tag_createdBy(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tag", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_searchFolders(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_searchFolders(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().SearchFolders(rctx, fc.Args["searchQuery"].(string), fc.Args["limit"].(int32), fc.Args["page"].(int32), fc.Args["userId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.SearchFoldersResponse) + fc.Result = res + return ec.marshalNSearchFoldersResponse2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchFoldersResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_searchFolders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "folders": + return ec.fieldContext_SearchFoldersResponse_folders(ctx, field) + case "total": + return ec.fieldContext_SearchFoldersResponse_total(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SearchFoldersResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_searchFolders_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_searchTags(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_searchTags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().SearchTags(rctx, fc.Args["searchQuery"].(string), fc.Args["folderId"].(string), fc.Args["limit"].(int32), fc.Args["page"].(int32), fc.Args["userId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.SearchTagsResponse) + fc.Result = res + return ec.marshalNSearchTagsResponse2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchTagsResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_searchTags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "tags": + return ec.fieldContext_SearchTagsResponse_tags(ctx, field) + case "total": + return ec.fieldContext_SearchTagsResponse_total(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SearchTagsResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_searchTags_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_searchCredentials(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_searchCredentials(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().SearchCredentials(rctx, fc.Args["searchQuery"].(string), fc.Args["folderId"].(*string), fc.Args["tagIds"].([]string), fc.Args["limit"].(int32), fc.Args["page"].(int32), fc.Args["userId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.SearchCredentialsResponse) + fc.Result = res + return ec.marshalNSearchCredentialsResponse2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchCredentialsResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_searchCredentials(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "credentials": + return ec.fieldContext_SearchCredentialsResponse_credentials(ctx, field) + case "total": + return ec.fieldContext_SearchCredentialsResponse_total(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SearchCredentialsResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_searchCredentials_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_expiresAt(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_expiresAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpiresAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_updatedAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_lastReadAt(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_lastReadAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastReadAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_lastReadAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_note(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_note(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Note, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_note(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_publicKey(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_publicKey(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PublicKey, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_publicKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_privateKey(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_privateKey(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PrivateKey, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_privateKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_title(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_userIdentifier(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_userIdentifier(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserIdentifier, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_userIdentifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_id(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_hostname(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_hostname(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hostname, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_hostname(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SSHCredential_customFields(ctx context.Context, field graphql.CollectedField, obj *model.SSHCredential) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SSHCredential_customFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CustomFields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOJSON2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SSHCredential_customFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SSHCredential", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type JSON does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SearchCredentialsResponse_credentials(ctx context.Context, field graphql.CollectedField, obj *model.SearchCredentialsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SearchCredentialsResponse_credentials(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Credentials, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.Credential) + fc.Result = res + return ec.marshalNCredential2ᚕgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐCredentialᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SearchCredentialsResponse_credentials(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SearchCredentialsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Credential does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SearchCredentialsResponse_total(ctx context.Context, field graphql.CollectedField, obj *model.SearchCredentialsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SearchCredentialsResponse_total(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Total, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int32) + fc.Result = res + return ec.marshalNInt2int32(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SearchCredentialsResponse_total(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SearchCredentialsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SearchFoldersResponse_folders(ctx context.Context, field graphql.CollectedField, obj *model.SearchFoldersResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SearchFoldersResponse_folders(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Folders, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Folder) + fc.Result = res + return ec.marshalNFolder2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolderᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SearchFoldersResponse_folders(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SearchFoldersResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Folder_id(ctx, field) + case "name": + return ec.fieldContext_Folder_name(ctx, field) + case "description": + return ec.fieldContext_Folder_description(ctx, field) + case "icon": + return ec.fieldContext_Folder_icon(ctx, field) + case "parent": + return ec.fieldContext_Folder_parent(ctx, field) + case "createdBy": + return ec.fieldContext_Folder_createdBy(ctx, field) + case "createdAt": + return ec.fieldContext_Folder_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Folder_updatedAt(ctx, field) + case "members": + return ec.fieldContext_Folder_members(ctx, field) + case "tags": + return ec.fieldContext_Folder_tags(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Folder", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _SearchFoldersResponse_total(ctx context.Context, field graphql.CollectedField, obj *model.SearchFoldersResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SearchFoldersResponse_total(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Total, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int32) + fc.Result = res + return ec.marshalNInt2int32(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SearchFoldersResponse_total(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SearchFoldersResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SearchTagsResponse_tags(ctx context.Context, field graphql.CollectedField, obj *model.SearchTagsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SearchTagsResponse_tags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Tags, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Tag) + fc.Result = res + return ec.marshalNTag2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTagᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SearchTagsResponse_tags(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SearchTagsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Tag_name(ctx, field) + case "color": + return ec.fieldContext_Tag_color(ctx, field) + case "folder": + return ec.fieldContext_Tag_folder(ctx, field) + case "createdBy": + return ec.fieldContext_Tag_createdBy(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Tag", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _SearchTagsResponse_total(ctx context.Context, field graphql.CollectedField, obj *model.SearchTagsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SearchTagsResponse_total(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Total, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int32) + fc.Result = res + return ec.marshalNInt2int32(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SearchTagsResponse_total(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SearchTagsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tag_name(ctx context.Context, field graphql.CollectedField, obj *model.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tag_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tag", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tag_color(ctx context.Context, field graphql.CollectedField, obj *model.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_color(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Color, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tag_color(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tag", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Tag_folder(ctx context.Context, field graphql.CollectedField, obj *model.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_folder(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Tag().Folder(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Folder) + fc.Result = res + return ec.marshalNFolder2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tag_folder(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tag", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Folder_id(ctx, field) + case "name": + return ec.fieldContext_Folder_name(ctx, field) + case "description": + return ec.fieldContext_Folder_description(ctx, field) + case "icon": + return ec.fieldContext_Folder_icon(ctx, field) + case "parent": + return ec.fieldContext_Folder_parent(ctx, field) + case "createdBy": + return ec.fieldContext_Folder_createdBy(ctx, field) + case "createdAt": + return ec.fieldContext_Folder_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Folder_updatedAt(ctx, field) + case "members": + return ec.fieldContext_Folder_members(ctx, field) + case "tags": + return ec.fieldContext_Folder_tags(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Folder", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Tag_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.Tag) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Tag_createdBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Tag().CreatedBy(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalNUser2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Tag_createdBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Tag", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "username": + return ec.fieldContext_User_username(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_username(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_username(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Username, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_username(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_email(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_email(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Email, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_isOneOf(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsOneOf(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalOBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputNewFolder(ctx context.Context, obj any) (model.NewFolder, error) { + var it model.NewFolder + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "description", "icon", "parent", "createdBy"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "description": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Description = data + case "icon": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("icon")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Icon = data + case "parent": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parent")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Parent = data + case "createdBy": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy")) + data, err := ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + it.CreatedBy = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func (ec *executionContext) _Credential(ctx context.Context, sel ast.SelectionSet, obj model.Credential) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case model.SSHCredential: + return ec._SSHCredential(ctx, sel, &obj) + case *model.SSHCredential: + if obj == nil { + return graphql.Null + } + return ec._SSHCredential(ctx, sel, obj) + case model.PasswordCredential: + return ec._PasswordCredential(ctx, sel, &obj) + case *model.PasswordCredential: + if obj == nil { + return graphql.Null + } + return ec._PasswordCredential(ctx, sel, obj) + case model.CardCredential: + return ec._CardCredential(ctx, sel, &obj) + case *model.CardCredential: + if obj == nil { + return graphql.Null + } + return ec._CardCredential(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var cardCredentialImplementors = []string{"CardCredential", "Credential"} + +func (ec *executionContext) _CardCredential(ctx context.Context, sel ast.SelectionSet, obj *model.CardCredential) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, cardCredentialImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CardCredential") + case "cardNumber": + out.Values[i] = ec._CardCredential_cardNumber(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._CardCredential_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "customFields": + out.Values[i] = ec._CardCredential_customFields(ctx, field, obj) + case "CVC": + out.Values[i] = ec._CardCredential_CVC(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expirationDate": + out.Values[i] = ec._CardCredential_expirationDate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expiresAt": + out.Values[i] = ec._CardCredential_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "id": + out.Values[i] = ec._CardCredential_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "lastReadAt": + out.Values[i] = ec._CardCredential_lastReadAt(ctx, field, obj) + case "note": + out.Values[i] = ec._CardCredential_note(ctx, field, obj) + case "ownerName": + out.Values[i] = ec._CardCredential_ownerName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._CardCredential_title(ctx, field, obj) + case "updatedAt": + out.Values[i] = ec._CardCredential_updatedAt(ctx, field, obj) + case "userIdentifier": + out.Values[i] = ec._CardCredential_userIdentifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var folderImplementors = []string{"Folder"} + +func (ec *executionContext) _Folder(ctx context.Context, sel ast.SelectionSet, obj *model.Folder) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, folderImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Folder") + case "id": + out.Values[i] = ec._Folder_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Folder_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "description": + out.Values[i] = ec._Folder_description(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "icon": + out.Values[i] = ec._Folder_icon(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "parent": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Folder_parent(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "createdBy": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Folder_createdBy(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "createdAt": + out.Values[i] = ec._Folder_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "updatedAt": + out.Values[i] = ec._Folder_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "members": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Folder_members(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "tags": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Folder_tags(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "createFolder": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createFolder(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteFolder": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteFolder(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var passwordCredentialImplementors = []string{"PasswordCredential", "Credential"} + +func (ec *executionContext) _PasswordCredential(ctx context.Context, sel ast.SelectionSet, obj *model.PasswordCredential) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, passwordCredentialImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PasswordCredential") + case "createdAt": + out.Values[i] = ec._PasswordCredential_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expiresAt": + out.Values[i] = ec._PasswordCredential_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._PasswordCredential_updatedAt(ctx, field, obj) + case "lastReadAt": + out.Values[i] = ec._PasswordCredential_lastReadAt(ctx, field, obj) + case "note": + out.Values[i] = ec._PasswordCredential_note(ctx, field, obj) + case "password": + out.Values[i] = ec._PasswordCredential_password(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._PasswordCredential_title(ctx, field, obj) + case "userIdentifier": + out.Values[i] = ec._PasswordCredential_userIdentifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "id": + out.Values[i] = ec._PasswordCredential_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "domainName": + out.Values[i] = ec._PasswordCredential_domainName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "customFields": + out.Values[i] = ec._PasswordCredential_customFields(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "credentials": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_credentials(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "folders": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_folders(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "tags": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_tags(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "searchFolders": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_searchFolders(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "searchTags": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_searchTags(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "searchCredentials": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_searchCredentials(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var sSHCredentialImplementors = []string{"SSHCredential", "Credential"} + +func (ec *executionContext) _SSHCredential(ctx context.Context, sel ast.SelectionSet, obj *model.SSHCredential) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, sSHCredentialImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SSHCredential") + case "createdAt": + out.Values[i] = ec._SSHCredential_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expiresAt": + out.Values[i] = ec._SSHCredential_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._SSHCredential_updatedAt(ctx, field, obj) + case "lastReadAt": + out.Values[i] = ec._SSHCredential_lastReadAt(ctx, field, obj) + case "note": + out.Values[i] = ec._SSHCredential_note(ctx, field, obj) + case "publicKey": + out.Values[i] = ec._SSHCredential_publicKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "privateKey": + out.Values[i] = ec._SSHCredential_privateKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._SSHCredential_title(ctx, field, obj) + case "userIdentifier": + out.Values[i] = ec._SSHCredential_userIdentifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "id": + out.Values[i] = ec._SSHCredential_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "hostname": + out.Values[i] = ec._SSHCredential_hostname(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "customFields": + out.Values[i] = ec._SSHCredential_customFields(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var searchCredentialsResponseImplementors = []string{"SearchCredentialsResponse"} + +func (ec *executionContext) _SearchCredentialsResponse(ctx context.Context, sel ast.SelectionSet, obj *model.SearchCredentialsResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, searchCredentialsResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SearchCredentialsResponse") + case "credentials": + out.Values[i] = ec._SearchCredentialsResponse_credentials(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "total": + out.Values[i] = ec._SearchCredentialsResponse_total(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var searchFoldersResponseImplementors = []string{"SearchFoldersResponse"} + +func (ec *executionContext) _SearchFoldersResponse(ctx context.Context, sel ast.SelectionSet, obj *model.SearchFoldersResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, searchFoldersResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SearchFoldersResponse") + case "folders": + out.Values[i] = ec._SearchFoldersResponse_folders(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "total": + out.Values[i] = ec._SearchFoldersResponse_total(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var searchTagsResponseImplementors = []string{"SearchTagsResponse"} + +func (ec *executionContext) _SearchTagsResponse(ctx context.Context, sel ast.SelectionSet, obj *model.SearchTagsResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, searchTagsResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SearchTagsResponse") + case "tags": + out.Values[i] = ec._SearchTagsResponse_tags(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "total": + out.Values[i] = ec._SearchTagsResponse_total(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var tagImplementors = []string{"Tag"} + +func (ec *executionContext) _Tag(ctx context.Context, sel ast.SelectionSet, obj *model.Tag) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, tagImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Tag") + case "name": + out.Values[i] = ec._Tag_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "color": + out.Values[i] = ec._Tag_color(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "folder": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Tag_folder(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "createdBy": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Tag_createdBy(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userImplementors = []string{"User"} + +func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *model.User) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("User") + case "id": + out.Values[i] = ec._User_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "username": + out.Values[i] = ec._User_username(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "email": + out.Values[i] = ec._User_email(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "isOneOf": + out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNCredential2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐCredential(ctx context.Context, sel ast.SelectionSet, v model.Credential) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Credential(ctx, sel, v) +} + +func (ec *executionContext) marshalNCredential2ᚕgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐCredentialᚄ(ctx context.Context, sel ast.SelectionSet, v []model.Credential) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCredential2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐCredential(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNFolder2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx context.Context, sel ast.SelectionSet, v model.Folder) graphql.Marshaler { + return ec._Folder(ctx, sel, &v) +} + +func (ec *executionContext) marshalNFolder2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolderᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Folder) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNFolder2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNFolder2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx context.Context, sel ast.SelectionSet, v *model.Folder) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Folder(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNID2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalID(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalID(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNInt2int32(ctx context.Context, v any) (int32, error) { + res, err := graphql.UnmarshalInt32(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInt2int32(ctx context.Context, sel ast.SelectionSet, v int32) graphql.Marshaler { + res := graphql.MarshalInt32(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNNewFolder2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐNewFolder(ctx context.Context, v any) (model.NewFolder, error) { + res, err := ec.unmarshalInputNewFolder(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNSearchCredentialsResponse2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchCredentialsResponse(ctx context.Context, sel ast.SelectionSet, v model.SearchCredentialsResponse) graphql.Marshaler { + return ec._SearchCredentialsResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNSearchCredentialsResponse2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchCredentialsResponse(ctx context.Context, sel ast.SelectionSet, v *model.SearchCredentialsResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._SearchCredentialsResponse(ctx, sel, v) +} + +func (ec *executionContext) marshalNSearchFoldersResponse2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchFoldersResponse(ctx context.Context, sel ast.SelectionSet, v model.SearchFoldersResponse) graphql.Marshaler { + return ec._SearchFoldersResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNSearchFoldersResponse2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchFoldersResponse(ctx context.Context, sel ast.SelectionSet, v *model.SearchFoldersResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._SearchFoldersResponse(ctx, sel, v) +} + +func (ec *executionContext) marshalNSearchTagsResponse2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchTagsResponse(ctx context.Context, sel ast.SelectionSet, v model.SearchTagsResponse) graphql.Marshaler { + return ec._SearchTagsResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNSearchTagsResponse2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐSearchTagsResponse(ctx context.Context, sel ast.SelectionSet, v *model.SearchTagsResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._SearchTagsResponse(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNTag2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTagᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Tag) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTag2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTag(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTag2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTag(ctx context.Context, sel ast.SelectionSet, v *model.Tag) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Tag(ctx, sel, v) +} + +func (ec *executionContext) marshalNUser2githubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v model.User) graphql.Marshaler { + return ec._User(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUserᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.User) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUser2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUser(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._User(ctx, sel, v) +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + return res +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalBoolean(*v) + return res +} + +func (ec *executionContext) marshalOFolder2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐFolder(ctx context.Context, sel ast.SelectionSet, v *model.Folder) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Folder(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOID2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNID2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOID2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNID2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalID(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalID(*v) + return res +} + +func (ec *executionContext) unmarshalOJSON2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOJSON2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) marshalOTag2ᚕᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTagᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Tag) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTag2ᚖgithubᚗcomᚋDOᚑ2K23ᚑ26ᚋpolypassᚑmicroservicesᚋgatewayᚋgraphᚋmodelᚐTag(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/gateway/graph/model/models_gen.go b/gateway/graph/model/models_gen.go new file mode 100644 index 0000000..02039fd --- /dev/null +++ b/gateway/graph/model/models_gen.go @@ -0,0 +1,113 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package model + +type Credential interface { + IsCredential() +} + +type CardCredential struct { + CardNumber string `json:"cardNumber"` + CreatedAt string `json:"createdAt"` + CustomFields *string `json:"customFields,omitempty"` + Cvc string `json:"CVC"` + ExpirationDate string `json:"expirationDate"` + ExpiresAt string `json:"expiresAt"` + ID string `json:"id"` + LastReadAt *string `json:"lastReadAt,omitempty"` + Note *string `json:"note,omitempty"` + OwnerName string `json:"ownerName"` + Title *string `json:"title,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + UserIdentifier string `json:"userIdentifier"` +} + +func (CardCredential) IsCredential() {} + +type Folder struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Icon string `json:"icon"` + Parent *Folder `json:"parent,omitempty"` + CreatedBy *User `json:"createdBy"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Members []*User `json:"members"` + Tags []*Tag `json:"tags,omitempty"` +} + +type Mutation struct { +} + +type NewFolder struct { + Name string `json:"name"` + Description string `json:"description"` + Icon string `json:"icon"` + Parent *string `json:"parent,omitempty"` + CreatedBy string `json:"createdBy"` +} + +type PasswordCredential struct { + CreatedAt string `json:"createdAt"` + ExpiresAt string `json:"expiresAt"` + UpdatedAt *string `json:"updatedAt,omitempty"` + LastReadAt *string `json:"lastReadAt,omitempty"` + Note *string `json:"note,omitempty"` + Password string `json:"password"` + Title *string `json:"title,omitempty"` + UserIdentifier string `json:"userIdentifier"` + ID string `json:"id"` + DomainName string `json:"domainName"` + CustomFields *string `json:"customFields,omitempty"` +} + +func (PasswordCredential) IsCredential() {} + +type Query struct { +} + +type SSHCredential struct { + CreatedAt string `json:"createdAt"` + ExpiresAt string `json:"expiresAt"` + UpdatedAt *string `json:"updatedAt,omitempty"` + LastReadAt *string `json:"lastReadAt,omitempty"` + Note *string `json:"note,omitempty"` + PublicKey string `json:"publicKey"` + PrivateKey string `json:"privateKey"` + Title *string `json:"title,omitempty"` + UserIdentifier string `json:"userIdentifier"` + ID string `json:"id"` + Hostname string `json:"hostname"` + CustomFields *string `json:"customFields,omitempty"` +} + +func (SSHCredential) IsCredential() {} + +type SearchCredentialsResponse struct { + Credentials []Credential `json:"credentials"` + Total int32 `json:"total"` +} + +type SearchFoldersResponse struct { + Folders []*Folder `json:"folders"` + Total int32 `json:"total"` +} + +type SearchTagsResponse struct { + Tags []*Tag `json:"tags"` + Total int32 `json:"total"` +} + +type Tag struct { + Name string `json:"name"` + Color string `json:"color"` + Folder *Folder `json:"folder"` + CreatedBy *User `json:"createdBy"` +} + +type User struct { + ID string `json:"id"` + Username string `json:"username"` + Email string `json:"email"` +} diff --git a/gateway/graph/resolver.go b/gateway/graph/resolver.go new file mode 100644 index 0000000..08cb4f0 --- /dev/null +++ b/gateway/graph/resolver.go @@ -0,0 +1,13 @@ +package graph + +import "github.com/DO-2K23-26/polypass-microservices/gateway/core" + +// This file will not be regenerated automatically. +// +// It serves as dependency injection for your app, add any dependencies you require here. + +type Resolver struct { + UsersService core.UsersService + OrganizationsService core.OrganizationService + SearchService core.SearchService +} diff --git a/gateway/graph/schema.graphqls b/gateway/graph/schema.graphqls new file mode 100644 index 0000000..0e9131e --- /dev/null +++ b/gateway/graph/schema.graphqls @@ -0,0 +1,97 @@ +# GraphQL schema example +# +# https://gqlgen.com/getting-started/ + +union Credential = PasswordCredential | SSHCredential | CardCredential + +scalar JSON + +type PasswordCredential { + createdAt: String! + expiresAt: String! + updatedAt: String + lastReadAt: String + note: String + password: String! + title: String + userIdentifier: String! + id: ID! + domainName: String! + customFields: JSON +} + +type SSHCredential { + createdAt: String! + expiresAt: String! + updatedAt: String + lastReadAt: String + note: String + publicKey: String! + privateKey: String! + title: String + userIdentifier: String! + id: ID! + hostname: String! + customFields: JSON +} + +type CardCredential { + cardNumber: String! + createdAt: String! + customFields: JSON + CVC: String! + expirationDate: String! + expiresAt: String! + id: ID! + lastReadAt: String + note: String + ownerName: String! + title: String + updatedAt: String + userIdentifier: String! +} + +type Folder { + id: ID! + name: String! + description: String! + icon: String! + parent: Folder + createdBy: User! + createdAt: String! + updatedAt: String! + members : [User!]! + tags: [Tag!] +} + +type Tag { + name: String! + color: String! + folder: Folder! + createdBy: User! +} + +type User { + id: ID! + username: String! + email: String! +} + +type Query { + credentials: [Credential!]! + folders: [Folder!]! + tags: [Tag!]! +} + +input NewFolder { + name: String! + description: String! + icon: String! + parent: ID + createdBy: ID! +} + +type Mutation { + createFolder(newFolder: NewFolder!): Folder! + deleteFolder(id: ID!): Boolean! +} diff --git a/gateway/graph/schema.resolvers.go b/gateway/graph/schema.resolvers.go new file mode 100644 index 0000000..7f6afb0 --- /dev/null +++ b/gateway/graph/schema.resolvers.go @@ -0,0 +1,147 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.68 + +import ( + "context" + "fmt" + + model1 "github.com/DO-2K23-26/polypass-microservices/gateway/graph/model" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/organizations" + "github.com/optique-dev/optique" +) + +// Parent is the resolver for the parent field. +func (r *folderResolver) Parent(ctx context.Context, obj *model1.Folder) (*model1.Folder, error) { + folder, err := r.OrganizationsService.GetFolder(obj.ID) + if err != nil { + return nil, err + } + return FolderToModel(&folder), nil +} + +// CreatedBy is the resolver for the createdBy field. +func (r *folderResolver) CreatedBy(ctx context.Context, obj *model1.Folder) (*model1.User, error) { + folder, err := r.OrganizationsService.GetFolder(obj.ID) + if err != nil { + return nil, err + } + return &model1.User{ + ID: folder.CreatedBy, + Username: "jul", + Email: "jul@gmail.com", + }, nil +} + +// Members is the resolver for the members field. +func (r *folderResolver) Members(ctx context.Context, obj *model1.Folder) ([]*model1.User, error) { + folder, err := r.OrganizationsService.GetFolder(obj.ID) + + if err != nil { + return nil, err + } + members := make([]*model1.User, len(folder.Members)) + for i, member := range folder.Members { + members[i] = &model1.User{ + ID: member, + Username: "jul", + Email: "jul@gmail.com", + } + } + return members, nil +} + +// Tags is the resolver for the tags field. +func (r *folderResolver) Tags(ctx context.Context, obj *model1.Folder) ([]*model1.Tag, error) { + panic(fmt.Errorf("not implemented: Tags - tags")) +} + +// CreateFolder is the resolver for the createFolder field. +func (r *mutationResolver) CreateFolder(ctx context.Context, newFolder model1.NewFolder) (*model1.Folder, error) { + folder, err := r.OrganizationsService.CreateFolder(organizations.CreateFolderRequest{ + Name: newFolder.Name, + ParentID: newFolder.Parent, + Description: newFolder.Description, + Icon: newFolder.Icon, + CreatedBy: newFolder.CreatedBy, + }) + if err != nil { + return nil, err + } + return FolderToModel(&folder), nil +} + +// DeleteFolder is the resolver for the deleteFolder field. +func (r *mutationResolver) DeleteFolder(ctx context.Context, id string) (bool, error) { + panic(fmt.Errorf("not implemented: DeleteFolder - deleteFolder")) +} + +// Credentials is the resolver for the credentials field. +func (r *queryResolver) Credentials(ctx context.Context) ([]model1.Credential, error) { + panic(fmt.Errorf("not implemented: Credentials - credentials")) +} + +// Folders is the resolver for the folders field. +func (r *queryResolver) Folders(ctx context.Context) ([]*model1.Folder, error) { + folders, err := r.OrganizationsService.GetFolders() + optique.Info(fmt.Sprintf("GetFolders: %v", folders)) + graphql_folders := make([]*model1.Folder, 0) + if err != nil { + optique.Error(err.Error()) + return nil, err + } + for _, folder := range folders { + graphql_folders = append(graphql_folders, FolderToModel(&folder)) + } + optique.Info(fmt.Sprintf("graphql_folders: %v", graphql_folders)) + return graphql_folders, nil +} + +// Tags is the resolver for the tags field. +func (r *queryResolver) Tags(ctx context.Context) ([]*model1.Tag, error) { + panic(fmt.Errorf("not implemented: Tags - tags")) +} + +// SearchFolders is the resolver for the searchFolders field. +func (r *queryResolver) SearchFolders(ctx context.Context, searchQuery string, limit int32, page int32, userID string) (*model1.SearchFoldersResponse, error) { + panic(fmt.Errorf("not implemented: SearchFolders - searchFolders")) +} + +// SearchTags is the resolver for the searchTags field. +func (r *queryResolver) SearchTags(ctx context.Context, searchQuery string, folderID string, limit int32, page int32, userID string) (*model1.SearchTagsResponse, error) { + panic(fmt.Errorf("not implemented: SearchTags - searchTags")) +} + +// SearchCredentials is the resolver for the searchCredentials field. +func (r *queryResolver) SearchCredentials(ctx context.Context, searchQuery string, folderID *string, tagIds []string, limit int32, page int32, userID string) (*model1.SearchCredentialsResponse, error) { + panic(fmt.Errorf("not implemented: SearchCredentials - searchCredentials")) +} + +// Folder is the resolver for the folder field. +func (r *tagResolver) Folder(ctx context.Context, obj *model1.Tag) (*model1.Folder, error) { + panic(fmt.Errorf("not implemented: Folder - folder")) +} + +// CreatedBy is the resolver for the createdBy field. +func (r *tagResolver) CreatedBy(ctx context.Context, obj *model1.Tag) (*model1.User, error) { + panic(fmt.Errorf("not implemented: CreatedBy - createdBy")) +} + +// Folder returns FolderResolver implementation. +func (r *Resolver) Folder() FolderResolver { return &folderResolver{r} } + +// Mutation returns MutationResolver implementation. +func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } + +// Query returns QueryResolver implementation. +func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } + +// Tag returns TagResolver implementation. +func (r *Resolver) Tag() TagResolver { return &tagResolver{r} } + +type folderResolver struct{ *Resolver } +type mutationResolver struct{ *Resolver } +type queryResolver struct{ *Resolver } +type tagResolver struct{ *Resolver } diff --git a/gateway/infrastructure/organizations/config.go b/gateway/infrastructure/organizations/config.go new file mode 100644 index 0000000..44fdcbe --- /dev/null +++ b/gateway/infrastructure/organizations/config.go @@ -0,0 +1,5 @@ +package organizations + +type Config struct { + Endpoint string `mapstructure:"endpoint" env:"ORGANIZATIONS_ENDPOINT"` +} diff --git a/gateway/infrastructure/organizations/organizations.go b/gateway/infrastructure/organizations/organizations.go new file mode 100644 index 0000000..0a7600e --- /dev/null +++ b/gateway/infrastructure/organizations/organizations.go @@ -0,0 +1,93 @@ +package organizations + +import ( + "strconv" + + "resty.dev/v3" +) + +type OrganizationAPI interface { + Setup() error + Shutdown() error + CreateFolder(payload CreateFolderRequest) (*CreateFolderResponse, error) + GetFolder(id string) (*GetFolderResponse, error) + GetFolders(page int, limit int) (*GetFoldersResponse, error) + UpdateFolder(id string, payload CreateFolderRequest) (*GetFolderResponse, error) + DeleteFolder(id string) error +} + +type organizationsAPI struct { + client *resty.Client + baseURL string +} + +func New(config Config) OrganizationAPI { + c := resty.New() + return &organizationsAPI{ + client: c, + baseURL: config.Endpoint, + } +} + +func (o *organizationsAPI) Setup() error { + return nil +} + +func (o *organizationsAPI) Shutdown() error { + return o.client.Close() +} + +func (o *organizationsAPI) CreateFolder(payload CreateFolderRequest) (*CreateFolderResponse, error) { + res, err := o.client.R(). + SetBody(payload). + SetResult(&CreateFolderResponse{}). + Post(o.baseURL + "/folders") + if err != nil { + return nil, err + } + response := res.Result().(*CreateFolderResponse) + return response, nil +} + +func (o *organizationsAPI) GetFolder(id string) (*GetFolderResponse, error) { + res, err := o.client.R(). + SetResult(&GetFolderResponse{}). + Get(o.baseURL + "/folders/" + id) + if err != nil { + return nil, err + } + response := res.Result().(*GetFolderResponse) + return response, nil +} + +func (o *organizationsAPI) GetFolders(page int, limit int) (*GetFoldersResponse, error) { + res, err := o.client.R(). + SetResult(&GetFoldersResponse{}). + Get(o.baseURL + "/folders?page=" + strconv.Itoa(page) + "&limit=" + strconv.Itoa(limit)) + if err != nil { + return nil, err + } + response := res.Result().(*GetFoldersResponse) + return response, nil +} + +func (o *organizationsAPI) UpdateFolder(id string, payload CreateFolderRequest) (*GetFolderResponse, error) { + res, err := o.client.R(). + SetBody(payload). + SetResult(&GetFolderResponse{}). + Put(o.baseURL + "/folders/" + id) + if err != nil { + return nil, err + } + response := res.Result().(*GetFolderResponse) + return response, nil +} + +func (o *organizationsAPI) DeleteFolder(id string) error { + _, err := o.client.R(). + Delete(o.baseURL + "/folders/" + id) + if err != nil { + return err + } + return nil +} diff --git a/gateway/infrastructure/organizations/types.go b/gateway/infrastructure/organizations/types.go new file mode 100644 index 0000000..7a18631 --- /dev/null +++ b/gateway/infrastructure/organizations/types.go @@ -0,0 +1,84 @@ +package organizations + +type CreateFolderRequest struct { + Name string `json:"name"` + Description string `json:"description"` + Icon string `json:"icon"` + ParentID *string `json:"parent_id,omitempty"` + CreatedBy string `json:"created_by"` +} + +type CreateFolderResponse struct { + ID string `json:"Id"` + Name string `json:"Name"` + Description string `json:"Description"` + Icon string `json:"Icon"` + CreatedAt string `json:"CreatedAt"` + UpdatedAt string `json:"UpdatedAt"` + ParentID *string `json:"ParentID"` + CreatedBy string `json:"CreatedBy"` + Members []string `json:"members"` +} + +type GetFolderResponse struct { + ID string `json:"Id"` + Name string `json:"Name"` + Description string `json:"Description"` + Icon string `json:"Icon"` + CreatedAt string `json:"CreatedAt"` + UpdatedAt string `json:"UpdatedAt"` + ParentID *string `json:"ParentID"` + CreatedBy string `json:"CreatedBy"` + Members []string `json:"members"` +} + +type GetFoldersResponse struct { + Folders []GetFolderResponse `json:"folders"` + Total int `json:"total"` + Page int `json:"page"` + Limit int `json:"limit"` +} + +type UpdateFolderRequest struct { + Name string `json:"name"` + Description string `json:"description"` + Icon string `json:"icon"` +} + +type GetCredentialsResponse struct { + Credentials []Credential `json:"credentials"` +} + +type Credential struct { + ID string `json:"id"` + CustomFields map[string]string `json:"custom_fields,omitempty"` + CardCredential + PasswordCredential + SSHCredential + ExpiresAt string `json:"expires_at"` + LastReadAt string `json:"last_read_at"` + UpdatedAt string `json:"updated_at"` + UserIdentifier string `json:"user_identifier"` + Title string `json:"title"` + Note string `json:"note"` +} + +type CardCredential struct { + CardNumCardCredentialber string `json:"card_number"` + CVC int `json:"cvc"` + ExpirationDate string `json:"expiration_date"` + OwnerName string `json:"owner_name"` +} + +type PasswordCredential struct { + CreatedAt string `json:"created_at"` + DomainName string `json:"domain_name"` + Password string `json:"password"` +} + +type SSHCredential struct { + CreatedAt string `json:"created_at"` + Hostname string `json:"hostname"` + PrivateKey string `json:"private_key"` + PublicKey string `json:"public_key"` +} diff --git a/gateway/infrastructure/repository.go b/gateway/infrastructure/repository.go new file mode 100644 index 0000000..74cacd1 --- /dev/null +++ b/gateway/infrastructure/repository.go @@ -0,0 +1,9 @@ +package infrastructure + +type Repository interface { + // script to be launched when repository is registered (e.g. for database migration) + Setup() error + + // script to be launched when the repository is deregistered (most of the time for graceful shutdown) + Shutdown() error +} diff --git a/gateway/infrastructure/search/config.go b/gateway/infrastructure/search/config.go new file mode 100644 index 0000000..661d400 --- /dev/null +++ b/gateway/infrastructure/search/config.go @@ -0,0 +1,7 @@ +// filepath: gateway/infrastructure/search/config.go +package search + +type Config struct { + // gRPC endpoint for SearchService, e.g., "localhost:50051" + Endpoint string `mapstructure:"endpoint" env:"SEARCH_ENDPOINT"` +} diff --git a/gateway/infrastructure/search/search.go b/gateway/infrastructure/search/search.go new file mode 100644 index 0000000..790150a --- /dev/null +++ b/gateway/infrastructure/search/search.go @@ -0,0 +1,53 @@ +// filepath: gateway/infrastructure/search/search.go +package search + +import ( + "fmt" + "time" + + "google.golang.org/grpc" + "github.com/DO-2K23-26/polypass-microservices/gateway/proto/search" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure" +) + +// SearchAPI defines the methods to interact with the gRPC SearchService +type SearchAPI interface { + infrastructure.Repository + SearchServiceClient() search.SearchServiceClient +} + +// client implements SearchAPI and repository +type client struct { + cfg Config + conn *grpc.ClientConn + client search.SearchServiceClient +} + +// New creates a new SearchAPI client +func New(cfg Config) SearchAPI { + return &client{cfg: cfg} +} + +// Setup establishes the gRPC connection +func (c *client) Setup() error { + conn, err := grpc.Dial(c.cfg.Endpoint, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second)) + if err != nil { + return fmt.Errorf("failed to dial search service: %w", err) + } + c.conn = conn + c.client = search.NewSearchServiceClient(conn) + return nil +} + +// Shutdown closes the gRPC connection +func (c *client) Shutdown() error { + if c.conn != nil { + return c.conn.Close() + } + return nil +} + +// SearchServiceClient returns the underlying gRPC client +func (c *client) SearchServiceClient() search.SearchServiceClient { + return c.client +} diff --git a/gateway/infrastructure/users/config.go b/gateway/infrastructure/users/config.go new file mode 100644 index 0000000..b8588b9 --- /dev/null +++ b/gateway/infrastructure/users/config.go @@ -0,0 +1,6 @@ +package users + +type UsersConfig struct { + Endpoint string `mapstructure:"endpoint"` +} + diff --git a/gateway/infrastructure/users/types.go b/gateway/infrastructure/users/types.go new file mode 100644 index 0000000..f572c65 --- /dev/null +++ b/gateway/infrastructure/users/types.go @@ -0,0 +1,2 @@ +package users +/// TODO: add types diff --git a/gateway/infrastructure/users/users.go b/gateway/infrastructure/users/users.go new file mode 100644 index 0000000..f4b734d --- /dev/null +++ b/gateway/infrastructure/users/users.go @@ -0,0 +1,23 @@ +package users + +type UserAPI interface { + Setup() error + Shutdown() error + GetUser(id string) (*GetUserResponse, error) +} + +type GetUserResponse struct { + ID string `json:"Id"` + Username string `json:"Username"` + Email string `json:"Email"` + CreatedAt string `json:"CreatedAt"` + UpdatedAt string `json:"UpdatedAt"` +} + +type usersAPI struct { + +} + +// func NewUsersAPI(config UsersConfig) UserAPI { +// return &usersAPI{} +// } diff --git a/gateway/justfile b/gateway/justfile new file mode 100644 index 0000000..c698124 --- /dev/null +++ b/gateway/justfile @@ -0,0 +1,8 @@ +build: + go build -o ./optique + +dev: + air +genql: + go run github.com/99designs/gqlgen generate + diff --git a/gateway/main.go b/gateway/main.go new file mode 100644 index 0000000..8176e26 --- /dev/null +++ b/gateway/main.go @@ -0,0 +1,67 @@ +package main + +import ( + "os" + + "github.com/DO-2K23-26/polypass-microservices/gateway/application/graphql" + "github.com/DO-2K23-26/polypass-microservices/gateway/application/searchhttp" + "github.com/DO-2K23-26/polypass-microservices/gateway/config" + "github.com/DO-2K23-26/polypass-microservices/gateway/core" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/organizations" + "github.com/DO-2K23-26/polypass-microservices/gateway/infrastructure/search" + "github.com/optique-dev/optique" +) + +// @title Optique application TO CHANGE +// @version 1.0 +// @description This is a sample application +// @contact.name Courtcircuits +// @contact.url https://github.com/Courtcircuits +// @contact.email tristan-mihai.radulescu@etu.umontpellier.fr +func main() { + conf, err := config.LoadConfig() + + if err != nil { + config.HandleError(err) + } + cycle := NewCycle() + + // Initialize organization REST client + organizations_api := organizations.New(conf.OrganizationConfig) + cycle.AddRepository(organizations_api) + + // Initialize gRPC search client + search_api := search.New(conf.SearchConfig) + // immediately dial search service so client is non-nil + if err := search_api.Setup(); err != nil { + optique.Error("cannot connect to search service: " + err.Error()) + os.Exit(1) + } + cycle.AddRepository(search_api) + + // add services + organizations_service := core.NewOrganizationsService(organizations_api) + // now that search_api is Setup, create core search service + search_service := core.NewSearchService(search_api.SearchServiceClient()) + + // add applications + api_gateway := graphql.NewHttp(conf.GraphQL) + api_gateway.WithHandler(graphql.NewHealthController()) + // REST search endpoints + searchController := searchhttp.NewController(search_service) + api_gateway.WithHandler(searchController) + api_gateway.WithHandler(graphql.NewGraphQL(organizations_service)) + + cycle.AddApplication(api_gateway) + + if conf.Bootstrap { + err := cycle.Setup() + if err != nil { + optique.Error(err.Error()) + cycle.Stop() + os.Exit(1) + } + } + + err = cycle.Ignite() +} diff --git a/gateway/optique b/gateway/optique new file mode 100755 index 0000000..2108263 Binary files /dev/null and b/gateway/optique differ diff --git a/gateway/optique.json b/gateway/optique.json new file mode 100644 index 0000000..73c3a2b --- /dev/null +++ b/gateway/optique.json @@ -0,0 +1 @@ +{"name":"gateway","module":"github.com/DO-2K23-26/polypass-microservices/gateway","repositories":[],"applications":[],"ignore":["go.mod","go.sum"]} \ No newline at end of file diff --git a/gateway/proto/github.com/DO-2K23-26/polypass-microservices/gateway/proto/search/search.pb.go b/gateway/proto/github.com/DO-2K23-26/polypass-microservices/gateway/proto/search/search.pb.go new file mode 100644 index 0000000..8f7bec4 --- /dev/null +++ b/gateway/proto/github.com/DO-2K23-26/polypass-microservices/gateway/proto/search/search.pb.go @@ -0,0 +1,766 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v6.30.1 +// source: search/search.proto + +package search + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Common message definitions +type Folder struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + ParentId string `protobuf:"bytes,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Folder) Reset() { + *x = Folder{} + mi := &file_search_search_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Folder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Folder) ProtoMessage() {} + +func (x *Folder) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Folder.ProtoReflect.Descriptor instead. +func (*Folder) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{0} +} + +func (x *Folder) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Folder) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Folder) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +type Tag struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + FolderId string `protobuf:"bytes,3,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Tag) Reset() { + *x = Tag{} + mi := &file_search_search_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Tag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Tag) ProtoMessage() {} + +func (x *Tag) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Tag.ProtoReflect.Descriptor instead. +func (*Tag) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{1} +} + +func (x *Tag) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Tag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Tag) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +type Credential struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + FolderId string `protobuf:"bytes,3,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + Folder *Folder `protobuf:"bytes,4,opt,name=folder,proto3" json:"folder,omitempty"` + Tags []*Tag `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Credential) Reset() { + *x = Credential{} + mi := &file_search_search_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Credential) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Credential) ProtoMessage() {} + +func (x *Credential) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Credential.ProtoReflect.Descriptor instead. +func (*Credential) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{2} +} + +func (x *Credential) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Credential) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Credential) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +func (x *Credential) GetFolder() *Folder { + if x != nil { + return x.Folder + } + return nil +} + +func (x *Credential) GetTags() []*Tag { + if x != nil { + return x.Tags + } + return nil +} + +// Folder search +type SearchFoldersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SearchQuery string `protobuf:"bytes,1,opt,name=search_query,json=searchQuery,proto3" json:"search_query,omitempty"` + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchFoldersRequest) Reset() { + *x = SearchFoldersRequest{} + mi := &file_search_search_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchFoldersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchFoldersRequest) ProtoMessage() {} + +func (x *SearchFoldersRequest) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchFoldersRequest.ProtoReflect.Descriptor instead. +func (*SearchFoldersRequest) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{3} +} + +func (x *SearchFoldersRequest) GetSearchQuery() string { + if x != nil { + return x.SearchQuery + } + return "" +} + +func (x *SearchFoldersRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchFoldersRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchFoldersRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SearchFoldersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Folders []*Folder `protobuf:"bytes,1,rep,name=folders,proto3" json:"folders,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchFoldersResponse) Reset() { + *x = SearchFoldersResponse{} + mi := &file_search_search_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchFoldersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchFoldersResponse) ProtoMessage() {} + +func (x *SearchFoldersResponse) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchFoldersResponse.ProtoReflect.Descriptor instead. +func (*SearchFoldersResponse) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{4} +} + +func (x *SearchFoldersResponse) GetFolders() []*Folder { + if x != nil { + return x.Folders + } + return nil +} + +func (x *SearchFoldersResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +// Tag search +type SearchTagsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SearchQuery string `protobuf:"bytes,1,opt,name=search_query,json=searchQuery,proto3" json:"search_query,omitempty"` + FolderId string `protobuf:"bytes,2,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` + UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchTagsRequest) Reset() { + *x = SearchTagsRequest{} + mi := &file_search_search_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchTagsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchTagsRequest) ProtoMessage() {} + +func (x *SearchTagsRequest) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchTagsRequest.ProtoReflect.Descriptor instead. +func (*SearchTagsRequest) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{5} +} + +func (x *SearchTagsRequest) GetSearchQuery() string { + if x != nil { + return x.SearchQuery + } + return "" +} + +func (x *SearchTagsRequest) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +func (x *SearchTagsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchTagsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchTagsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SearchTagsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tags []*Tag `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchTagsResponse) Reset() { + *x = SearchTagsResponse{} + mi := &file_search_search_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchTagsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchTagsResponse) ProtoMessage() {} + +func (x *SearchTagsResponse) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchTagsResponse.ProtoReflect.Descriptor instead. +func (*SearchTagsResponse) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{6} +} + +func (x *SearchTagsResponse) GetTags() []*Tag { + if x != nil { + return x.Tags + } + return nil +} + +func (x *SearchTagsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +// Credential search +type SearchCredentialsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SearchQuery string `protobuf:"bytes,1,opt,name=search_query,json=searchQuery,proto3" json:"search_query,omitempty"` + FolderId string `protobuf:"bytes,2,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + TagIds []string `protobuf:"bytes,4,rep,name=tag_ids,json=tagIds,proto3" json:"tag_ids,omitempty"` + Limit int32 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` + Page int32 `protobuf:"varint,7,opt,name=page,proto3" json:"page,omitempty"` + UserId string `protobuf:"bytes,8,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchCredentialsRequest) Reset() { + *x = SearchCredentialsRequest{} + mi := &file_search_search_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchCredentialsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchCredentialsRequest) ProtoMessage() {} + +func (x *SearchCredentialsRequest) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchCredentialsRequest.ProtoReflect.Descriptor instead. +func (*SearchCredentialsRequest) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{7} +} + +func (x *SearchCredentialsRequest) GetSearchQuery() string { + if x != nil { + return x.SearchQuery + } + return "" +} + +func (x *SearchCredentialsRequest) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +func (x *SearchCredentialsRequest) GetTagIds() []string { + if x != nil { + return x.TagIds + } + return nil +} + +func (x *SearchCredentialsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchCredentialsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchCredentialsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SearchCredentialsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Credentials []*Credential `protobuf:"bytes,1,rep,name=credentials,proto3" json:"credentials,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchCredentialsResponse) Reset() { + *x = SearchCredentialsResponse{} + mi := &file_search_search_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchCredentialsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchCredentialsResponse) ProtoMessage() {} + +func (x *SearchCredentialsResponse) ProtoReflect() protoreflect.Message { + mi := &file_search_search_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchCredentialsResponse.ProtoReflect.Descriptor instead. +func (*SearchCredentialsResponse) Descriptor() ([]byte, []int) { + return file_search_search_proto_rawDescGZIP(), []int{8} +} + +func (x *SearchCredentialsResponse) GetCredentials() []*Credential { + if x != nil { + return x.Credentials + } + return nil +} + +func (x *SearchCredentialsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +var File_search_search_proto protoreflect.FileDescriptor + +var file_search_search_proto_rawDesc = string([]byte{ + 0x0a, 0x13, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x22, 0x49, 0x0a, + 0x06, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x46, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x49, 0x64, + 0x22, 0x98, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x46, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x52, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x7c, 0x0a, 0x14, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x57, 0x0a, 0x15, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x28, 0x0a, 0x07, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x46, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x52, 0x07, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x22, 0x96, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x66, + 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, + 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x4b, 0x0a, 0x12, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, + 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xb6, 0x01, 0x0a, 0x18, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x67, 0x5f, 0x69, 0x64, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x67, 0x49, 0x64, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x22, 0x67, 0x0a, 0x19, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, + 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x43, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x32, 0xfc, 0x01, 0x0a, 0x0d, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x0d, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, + 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x58, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x73, 0x12, 0x20, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x4f, 0x2d, 0x32, 0x4b, 0x32, 0x33, 0x2d, + 0x32, 0x36, 0x2f, 0x70, 0x6f, 0x6c, 0x79, 0x70, 0x61, 0x73, 0x73, 0x2d, 0x6d, 0x69, 0x63, 0x72, + 0x6f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x3b, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_search_search_proto_rawDescOnce sync.Once + file_search_search_proto_rawDescData []byte +) + +func file_search_search_proto_rawDescGZIP() []byte { + file_search_search_proto_rawDescOnce.Do(func() { + file_search_search_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_search_search_proto_rawDesc), len(file_search_search_proto_rawDesc))) + }) + return file_search_search_proto_rawDescData +} + +var file_search_search_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_search_search_proto_goTypes = []any{ + (*Folder)(nil), // 0: search.Folder + (*Tag)(nil), // 1: search.Tag + (*Credential)(nil), // 2: search.Credential + (*SearchFoldersRequest)(nil), // 3: search.SearchFoldersRequest + (*SearchFoldersResponse)(nil), // 4: search.SearchFoldersResponse + (*SearchTagsRequest)(nil), // 5: search.SearchTagsRequest + (*SearchTagsResponse)(nil), // 6: search.SearchTagsResponse + (*SearchCredentialsRequest)(nil), // 7: search.SearchCredentialsRequest + (*SearchCredentialsResponse)(nil), // 8: search.SearchCredentialsResponse +} +var file_search_search_proto_depIdxs = []int32{ + 0, // 0: search.Credential.folder:type_name -> search.Folder + 1, // 1: search.Credential.tags:type_name -> search.Tag + 0, // 2: search.SearchFoldersResponse.folders:type_name -> search.Folder + 1, // 3: search.SearchTagsResponse.tags:type_name -> search.Tag + 2, // 4: search.SearchCredentialsResponse.credentials:type_name -> search.Credential + 3, // 5: search.SearchService.SearchFolders:input_type -> search.SearchFoldersRequest + 5, // 6: search.SearchService.SearchTags:input_type -> search.SearchTagsRequest + 7, // 7: search.SearchService.SearchCredentials:input_type -> search.SearchCredentialsRequest + 4, // 8: search.SearchService.SearchFolders:output_type -> search.SearchFoldersResponse + 6, // 9: search.SearchService.SearchTags:output_type -> search.SearchTagsResponse + 8, // 10: search.SearchService.SearchCredentials:output_type -> search.SearchCredentialsResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_search_search_proto_init() } +func file_search_search_proto_init() { + if File_search_search_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_search_search_proto_rawDesc), len(file_search_search_proto_rawDesc)), + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_search_search_proto_goTypes, + DependencyIndexes: file_search_search_proto_depIdxs, + MessageInfos: file_search_search_proto_msgTypes, + }.Build() + File_search_search_proto = out.File + file_search_search_proto_goTypes = nil + file_search_search_proto_depIdxs = nil +} diff --git a/gateway/proto/github.com/DO-2K23-26/polypass-microservices/gateway/proto/search/search_grpc.pb.go b/gateway/proto/github.com/DO-2K23-26/polypass-microservices/gateway/proto/search/search_grpc.pb.go new file mode 100644 index 0000000..0ef7919 --- /dev/null +++ b/gateway/proto/github.com/DO-2K23-26/polypass-microservices/gateway/proto/search/search_grpc.pb.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.30.1 +// source: search/search.proto + +package search + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SearchService_SearchFolders_FullMethodName = "/search.SearchService/SearchFolders" + SearchService_SearchTags_FullMethodName = "/search.SearchService/SearchTags" + SearchService_SearchCredentials_FullMethodName = "/search.SearchService/SearchCredentials" +) + +// SearchServiceClient is the client API for SearchService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SearchServiceClient interface { + // Search for folders + SearchFolders(ctx context.Context, in *SearchFoldersRequest, opts ...grpc.CallOption) (*SearchFoldersResponse, error) + // Search for tags + SearchTags(ctx context.Context, in *SearchTagsRequest, opts ...grpc.CallOption) (*SearchTagsResponse, error) + // Search for credentials + SearchCredentials(ctx context.Context, in *SearchCredentialsRequest, opts ...grpc.CallOption) (*SearchCredentialsResponse, error) +} + +type searchServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient { + return &searchServiceClient{cc} +} + +func (c *searchServiceClient) SearchFolders(ctx context.Context, in *SearchFoldersRequest, opts ...grpc.CallOption) (*SearchFoldersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchFoldersResponse) + err := c.cc.Invoke(ctx, SearchService_SearchFolders_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchTags(ctx context.Context, in *SearchTagsRequest, opts ...grpc.CallOption) (*SearchTagsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchTagsResponse) + err := c.cc.Invoke(ctx, SearchService_SearchTags_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchCredentials(ctx context.Context, in *SearchCredentialsRequest, opts ...grpc.CallOption) (*SearchCredentialsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchCredentialsResponse) + err := c.cc.Invoke(ctx, SearchService_SearchCredentials_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SearchServiceServer is the server API for SearchService service. +// All implementations must embed UnimplementedSearchServiceServer +// for forward compatibility. +type SearchServiceServer interface { + // Search for folders + SearchFolders(context.Context, *SearchFoldersRequest) (*SearchFoldersResponse, error) + // Search for tags + SearchTags(context.Context, *SearchTagsRequest) (*SearchTagsResponse, error) + // Search for credentials + SearchCredentials(context.Context, *SearchCredentialsRequest) (*SearchCredentialsResponse, error) + mustEmbedUnimplementedSearchServiceServer() +} + +// UnimplementedSearchServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSearchServiceServer struct{} + +func (UnimplementedSearchServiceServer) SearchFolders(context.Context, *SearchFoldersRequest) (*SearchFoldersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchFolders not implemented") +} +func (UnimplementedSearchServiceServer) SearchTags(context.Context, *SearchTagsRequest) (*SearchTagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchTags not implemented") +} +func (UnimplementedSearchServiceServer) SearchCredentials(context.Context, *SearchCredentialsRequest) (*SearchCredentialsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchCredentials not implemented") +} +func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {} +func (UnimplementedSearchServiceServer) testEmbeddedByValue() {} + +// UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SearchServiceServer will +// result in compilation errors. +type UnsafeSearchServiceServer interface { + mustEmbedUnimplementedSearchServiceServer() +} + +func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) { + // If the following call pancis, it indicates UnimplementedSearchServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SearchService_ServiceDesc, srv) +} + +func _SearchService_SearchFolders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchFoldersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchFolders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchFolders_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchFolders(ctx, req.(*SearchFoldersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchTagsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchTags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchTags_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchTags(ctx, req.(*SearchTagsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchCredentials_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchCredentialsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchCredentials(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchCredentials_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchCredentials(ctx, req.(*SearchCredentialsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SearchService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "search.SearchService", + HandlerType: (*SearchServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SearchFolders", + Handler: _SearchService_SearchFolders_Handler, + }, + { + MethodName: "SearchTags", + Handler: _SearchService_SearchTags_Handler, + }, + { + MethodName: "SearchCredentials", + Handler: _SearchService_SearchCredentials_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "search/search.proto", +} diff --git a/gateway/proto/search/search.pb.go b/gateway/proto/search/search.pb.go new file mode 100644 index 0000000..d65fdcc --- /dev/null +++ b/gateway/proto/search/search.pb.go @@ -0,0 +1,767 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v6.30.1 +// source: proto/search/search.proto + +package search + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Common message definitions +type Folder struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + ParentId string `protobuf:"bytes,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Folder) Reset() { + *x = Folder{} + mi := &file_proto_search_search_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Folder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Folder) ProtoMessage() {} + +func (x *Folder) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Folder.ProtoReflect.Descriptor instead. +func (*Folder) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{0} +} + +func (x *Folder) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Folder) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Folder) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +type Tag struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + FolderId string `protobuf:"bytes,3,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Tag) Reset() { + *x = Tag{} + mi := &file_proto_search_search_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Tag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Tag) ProtoMessage() {} + +func (x *Tag) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Tag.ProtoReflect.Descriptor instead. +func (*Tag) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{1} +} + +func (x *Tag) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Tag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Tag) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +type Credential struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + FolderId string `protobuf:"bytes,3,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + Folder *Folder `protobuf:"bytes,4,opt,name=folder,proto3" json:"folder,omitempty"` + Tags []*Tag `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Credential) Reset() { + *x = Credential{} + mi := &file_proto_search_search_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Credential) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Credential) ProtoMessage() {} + +func (x *Credential) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Credential.ProtoReflect.Descriptor instead. +func (*Credential) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{2} +} + +func (x *Credential) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Credential) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Credential) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +func (x *Credential) GetFolder() *Folder { + if x != nil { + return x.Folder + } + return nil +} + +func (x *Credential) GetTags() []*Tag { + if x != nil { + return x.Tags + } + return nil +} + +// Folder search +type SearchFoldersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SearchQuery string `protobuf:"bytes,1,opt,name=search_query,json=searchQuery,proto3" json:"search_query,omitempty"` + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchFoldersRequest) Reset() { + *x = SearchFoldersRequest{} + mi := &file_proto_search_search_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchFoldersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchFoldersRequest) ProtoMessage() {} + +func (x *SearchFoldersRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchFoldersRequest.ProtoReflect.Descriptor instead. +func (*SearchFoldersRequest) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{3} +} + +func (x *SearchFoldersRequest) GetSearchQuery() string { + if x != nil { + return x.SearchQuery + } + return "" +} + +func (x *SearchFoldersRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchFoldersRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchFoldersRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SearchFoldersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Folders []*Folder `protobuf:"bytes,1,rep,name=folders,proto3" json:"folders,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchFoldersResponse) Reset() { + *x = SearchFoldersResponse{} + mi := &file_proto_search_search_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchFoldersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchFoldersResponse) ProtoMessage() {} + +func (x *SearchFoldersResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchFoldersResponse.ProtoReflect.Descriptor instead. +func (*SearchFoldersResponse) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{4} +} + +func (x *SearchFoldersResponse) GetFolders() []*Folder { + if x != nil { + return x.Folders + } + return nil +} + +func (x *SearchFoldersResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +// Tag search +type SearchTagsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SearchQuery string `protobuf:"bytes,1,opt,name=search_query,json=searchQuery,proto3" json:"search_query,omitempty"` + FolderId string `protobuf:"bytes,2,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` + UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchTagsRequest) Reset() { + *x = SearchTagsRequest{} + mi := &file_proto_search_search_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchTagsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchTagsRequest) ProtoMessage() {} + +func (x *SearchTagsRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchTagsRequest.ProtoReflect.Descriptor instead. +func (*SearchTagsRequest) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{5} +} + +func (x *SearchTagsRequest) GetSearchQuery() string { + if x != nil { + return x.SearchQuery + } + return "" +} + +func (x *SearchTagsRequest) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +func (x *SearchTagsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchTagsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchTagsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SearchTagsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tags []*Tag `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchTagsResponse) Reset() { + *x = SearchTagsResponse{} + mi := &file_proto_search_search_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchTagsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchTagsResponse) ProtoMessage() {} + +func (x *SearchTagsResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchTagsResponse.ProtoReflect.Descriptor instead. +func (*SearchTagsResponse) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{6} +} + +func (x *SearchTagsResponse) GetTags() []*Tag { + if x != nil { + return x.Tags + } + return nil +} + +func (x *SearchTagsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +// Credential search +type SearchCredentialsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SearchQuery string `protobuf:"bytes,1,opt,name=search_query,json=searchQuery,proto3" json:"search_query,omitempty"` + FolderId string `protobuf:"bytes,2,opt,name=folder_id,json=folderId,proto3" json:"folder_id,omitempty"` + TagIds []string `protobuf:"bytes,4,rep,name=tag_ids,json=tagIds,proto3" json:"tag_ids,omitempty"` + Limit int32 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` + Page int32 `protobuf:"varint,7,opt,name=page,proto3" json:"page,omitempty"` + UserId string `protobuf:"bytes,8,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Required for permission check + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchCredentialsRequest) Reset() { + *x = SearchCredentialsRequest{} + mi := &file_proto_search_search_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchCredentialsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchCredentialsRequest) ProtoMessage() {} + +func (x *SearchCredentialsRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchCredentialsRequest.ProtoReflect.Descriptor instead. +func (*SearchCredentialsRequest) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{7} +} + +func (x *SearchCredentialsRequest) GetSearchQuery() string { + if x != nil { + return x.SearchQuery + } + return "" +} + +func (x *SearchCredentialsRequest) GetFolderId() string { + if x != nil { + return x.FolderId + } + return "" +} + +func (x *SearchCredentialsRequest) GetTagIds() []string { + if x != nil { + return x.TagIds + } + return nil +} + +func (x *SearchCredentialsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchCredentialsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchCredentialsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SearchCredentialsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Credentials []*Credential `protobuf:"bytes,1,rep,name=credentials,proto3" json:"credentials,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchCredentialsResponse) Reset() { + *x = SearchCredentialsResponse{} + mi := &file_proto_search_search_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchCredentialsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchCredentialsResponse) ProtoMessage() {} + +func (x *SearchCredentialsResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_search_search_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchCredentialsResponse.ProtoReflect.Descriptor instead. +func (*SearchCredentialsResponse) Descriptor() ([]byte, []int) { + return file_proto_search_search_proto_rawDescGZIP(), []int{8} +} + +func (x *SearchCredentialsResponse) GetCredentials() []*Credential { + if x != nil { + return x.Credentials + } + return nil +} + +func (x *SearchCredentialsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +var File_proto_search_search_proto protoreflect.FileDescriptor + +var file_proto_search_search_proto_rawDesc = string([]byte{ + 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2f, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x22, 0x49, 0x0a, 0x06, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x46, + 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6f, + 0x6c, 0x64, 0x65, 0x72, 0x49, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, + 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x66, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x2e, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x52, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x22, 0x7c, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, + 0x57, 0x0a, 0x15, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x07, 0x66, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x2e, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x52, 0x07, 0x66, 0x6f, 0x6c, 0x64, 0x65, + 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x96, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, + 0x0a, 0x0c, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x22, 0x4b, 0x0a, 0x12, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x54, + 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xb6, + 0x01, 0x0a, 0x18, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, + 0x0a, 0x09, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, + 0x61, 0x67, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, + 0x67, 0x49, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x19, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x0b, 0x63, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x32, 0xfc, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x43, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x12, 0x19, + 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, + 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x73, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x20, 0x2e, 0x73, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x4f, + 0x2d, 0x32, 0x4b, 0x32, 0x33, 0x2d, 0x32, 0x36, 0x2f, 0x70, 0x6f, 0x6c, 0x79, 0x70, 0x61, 0x73, + 0x73, 0x2d, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x3b, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +}) + +var ( + file_proto_search_search_proto_rawDescOnce sync.Once + file_proto_search_search_proto_rawDescData []byte +) + +func file_proto_search_search_proto_rawDescGZIP() []byte { + file_proto_search_search_proto_rawDescOnce.Do(func() { + file_proto_search_search_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_search_search_proto_rawDesc), len(file_proto_search_search_proto_rawDesc))) + }) + return file_proto_search_search_proto_rawDescData +} + +var file_proto_search_search_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_proto_search_search_proto_goTypes = []any{ + (*Folder)(nil), // 0: search.Folder + (*Tag)(nil), // 1: search.Tag + (*Credential)(nil), // 2: search.Credential + (*SearchFoldersRequest)(nil), // 3: search.SearchFoldersRequest + (*SearchFoldersResponse)(nil), // 4: search.SearchFoldersResponse + (*SearchTagsRequest)(nil), // 5: search.SearchTagsRequest + (*SearchTagsResponse)(nil), // 6: search.SearchTagsResponse + (*SearchCredentialsRequest)(nil), // 7: search.SearchCredentialsRequest + (*SearchCredentialsResponse)(nil), // 8: search.SearchCredentialsResponse +} +var file_proto_search_search_proto_depIdxs = []int32{ + 0, // 0: search.Credential.folder:type_name -> search.Folder + 1, // 1: search.Credential.tags:type_name -> search.Tag + 0, // 2: search.SearchFoldersResponse.folders:type_name -> search.Folder + 1, // 3: search.SearchTagsResponse.tags:type_name -> search.Tag + 2, // 4: search.SearchCredentialsResponse.credentials:type_name -> search.Credential + 3, // 5: search.SearchService.SearchFolders:input_type -> search.SearchFoldersRequest + 5, // 6: search.SearchService.SearchTags:input_type -> search.SearchTagsRequest + 7, // 7: search.SearchService.SearchCredentials:input_type -> search.SearchCredentialsRequest + 4, // 8: search.SearchService.SearchFolders:output_type -> search.SearchFoldersResponse + 6, // 9: search.SearchService.SearchTags:output_type -> search.SearchTagsResponse + 8, // 10: search.SearchService.SearchCredentials:output_type -> search.SearchCredentialsResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_proto_search_search_proto_init() } +func file_proto_search_search_proto_init() { + if File_proto_search_search_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_search_search_proto_rawDesc), len(file_proto_search_search_proto_rawDesc)), + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_search_search_proto_goTypes, + DependencyIndexes: file_proto_search_search_proto_depIdxs, + MessageInfos: file_proto_search_search_proto_msgTypes, + }.Build() + File_proto_search_search_proto = out.File + file_proto_search_search_proto_goTypes = nil + file_proto_search_search_proto_depIdxs = nil +} diff --git a/gateway/proto/search/search.proto b/gateway/proto/search/search.proto new file mode 100644 index 0000000..e67017b --- /dev/null +++ b/gateway/proto/search/search.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; + +package search; +option go_package = "github.com/DO-2K23-26/polypass-microservices/gateway/proto/search;search"; + +service SearchService { + // Search for folders + rpc SearchFolders(SearchFoldersRequest) returns (SearchFoldersResponse); + + // Search for tags + rpc SearchTags(SearchTagsRequest) returns (SearchTagsResponse); + + // Search for credentials + rpc SearchCredentials(SearchCredentialsRequest) returns (SearchCredentialsResponse); +} + +// Common message definitions +message Folder { + string id = 1; + string name = 2; + string parent_id = 3; // Required for permission check +} + +message Tag { + string id = 1; + string name = 2; + string folder_id = 3; +} + +message Credential { + string id = 1; + string title = 2; + string folder_id = 3; + Folder folder = 4; + repeated Tag tags = 5; +} + +// Folder search +message SearchFoldersRequest { + string search_query = 1; + int32 limit = 2; + int32 page = 3; + string user_id = 4; // Required for permission check +} + +message SearchFoldersResponse { + repeated Folder folders = 1; + int32 total = 2; +} + +// Tag search +message SearchTagsRequest { + string search_query = 1; + string folder_id = 2; + int32 limit = 3; + int32 page = 4; + string user_id = 5; // Required for permission check +} + +message SearchTagsResponse { + repeated Tag tags = 1; + int32 total = 2; +} + +// Credential search +message SearchCredentialsRequest { + string search_query = 1; + string folder_id = 2; + repeated string tag_ids = 4; + int32 limit = 6; + int32 page = 7; + string user_id = 8; // Required for permission check +} + +message SearchCredentialsResponse { + repeated Credential credentials = 1; + int32 total = 2; +} diff --git a/gateway/proto/search/search_grpc.pb.go b/gateway/proto/search/search_grpc.pb.go new file mode 100644 index 0000000..6a01dc5 --- /dev/null +++ b/gateway/proto/search/search_grpc.pb.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.30.1 +// source: proto/search/search.proto + +package search + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SearchService_SearchFolders_FullMethodName = "/search.SearchService/SearchFolders" + SearchService_SearchTags_FullMethodName = "/search.SearchService/SearchTags" + SearchService_SearchCredentials_FullMethodName = "/search.SearchService/SearchCredentials" +) + +// SearchServiceClient is the client API for SearchService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SearchServiceClient interface { + // Search for folders + SearchFolders(ctx context.Context, in *SearchFoldersRequest, opts ...grpc.CallOption) (*SearchFoldersResponse, error) + // Search for tags + SearchTags(ctx context.Context, in *SearchTagsRequest, opts ...grpc.CallOption) (*SearchTagsResponse, error) + // Search for credentials + SearchCredentials(ctx context.Context, in *SearchCredentialsRequest, opts ...grpc.CallOption) (*SearchCredentialsResponse, error) +} + +type searchServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient { + return &searchServiceClient{cc} +} + +func (c *searchServiceClient) SearchFolders(ctx context.Context, in *SearchFoldersRequest, opts ...grpc.CallOption) (*SearchFoldersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchFoldersResponse) + err := c.cc.Invoke(ctx, SearchService_SearchFolders_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchTags(ctx context.Context, in *SearchTagsRequest, opts ...grpc.CallOption) (*SearchTagsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchTagsResponse) + err := c.cc.Invoke(ctx, SearchService_SearchTags_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchCredentials(ctx context.Context, in *SearchCredentialsRequest, opts ...grpc.CallOption) (*SearchCredentialsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchCredentialsResponse) + err := c.cc.Invoke(ctx, SearchService_SearchCredentials_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SearchServiceServer is the server API for SearchService service. +// All implementations must embed UnimplementedSearchServiceServer +// for forward compatibility. +type SearchServiceServer interface { + // Search for folders + SearchFolders(context.Context, *SearchFoldersRequest) (*SearchFoldersResponse, error) + // Search for tags + SearchTags(context.Context, *SearchTagsRequest) (*SearchTagsResponse, error) + // Search for credentials + SearchCredentials(context.Context, *SearchCredentialsRequest) (*SearchCredentialsResponse, error) + mustEmbedUnimplementedSearchServiceServer() +} + +// UnimplementedSearchServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSearchServiceServer struct{} + +func (UnimplementedSearchServiceServer) SearchFolders(context.Context, *SearchFoldersRequest) (*SearchFoldersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchFolders not implemented") +} +func (UnimplementedSearchServiceServer) SearchTags(context.Context, *SearchTagsRequest) (*SearchTagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchTags not implemented") +} +func (UnimplementedSearchServiceServer) SearchCredentials(context.Context, *SearchCredentialsRequest) (*SearchCredentialsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchCredentials not implemented") +} +func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {} +func (UnimplementedSearchServiceServer) testEmbeddedByValue() {} + +// UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SearchServiceServer will +// result in compilation errors. +type UnsafeSearchServiceServer interface { + mustEmbedUnimplementedSearchServiceServer() +} + +func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) { + // If the following call pancis, it indicates UnimplementedSearchServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SearchService_ServiceDesc, srv) +} + +func _SearchService_SearchFolders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchFoldersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchFolders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchFolders_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchFolders(ctx, req.(*SearchFoldersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchTagsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchTags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchTags_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchTags(ctx, req.(*SearchTagsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchCredentials_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchCredentialsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchCredentials(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchCredentials_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchCredentials(ctx, req.(*SearchCredentialsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SearchService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "search.SearchService", + HandlerType: (*SearchServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SearchFolders", + Handler: _SearchService_SearchFolders_Handler, + }, + { + MethodName: "SearchTags", + Handler: _SearchService_SearchTags_Handler, + }, + { + MethodName: "SearchCredentials", + Handler: _SearchService_SearchCredentials_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/search/search.proto", +} diff --git a/gateway/search_stub/README.md b/gateway/search_stub/README.md new file mode 100644 index 0000000..ac48192 --- /dev/null +++ b/gateway/search_stub/README.md @@ -0,0 +1,13 @@ +# Mock SearchService Stub + +Pour lancer le stub gRPC de SearchService : + +```bash +cd search_stub +go run main.go +``` + +Le stub expose : +- SearchFolders → 1 dossier factice +- SearchTags → 1 tag factice +- SearchCredentials → 1 credential factice diff --git a/gateway/search_stub/go.mod b/gateway/search_stub/go.mod new file mode 100644 index 0000000..83ce2c9 --- /dev/null +++ b/gateway/search_stub/go.mod @@ -0,0 +1,31 @@ +module github.com/DO-2K23-26/polypass-microservices/gateway/search_stub + +go 1.24.4 + +replace github.com/DO-2K23-26/polypass-microservices/gateway => ../ + +require ( + github.com/DO-2K23-26/polypass-microservices/gateway v0.0.0-00010101000000-000000000000 + google.golang.org/grpc v1.67.3 +) + +require ( + github.com/99designs/gqlgen v0.17.74 // indirect + github.com/agnivade/levenshtein v1.2.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/sosodev/duration v1.3.1 // indirect + github.com/urfave/cli/v2 v2.27.6 // indirect + github.com/vektah/gqlparser/v2 v2.5.27 // indirect + github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sync v0.15.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect + golang.org/x/tools v0.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect + google.golang.org/protobuf v1.36.6 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/gateway/search_stub/go.sum b/gateway/search_stub/go.sum new file mode 100644 index 0000000..3d44134 --- /dev/null +++ b/gateway/search_stub/go.sum @@ -0,0 +1,41 @@ +github.com/99designs/gqlgen v0.17.74 h1:1FuVtkXxOc87xpKio3f6sohREmec+Jvy86PcYOuwgWo= +github.com/99designs/gqlgen v0.17.74/go.mod h1:a+iR6mfRLNRp++kDpooFHiPWYiWX3Yu1BIilQRHgh10= +github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= +github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= +github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g= +github.com/urfave/cli/v2 v2.27.6/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= +github.com/vektah/gqlparser/v2 v2.5.27 h1:RHPD3JOplpk5mP5JGX8RKZkt2/Vwj/PZv0HxTdwFp0s= +github.com/vektah/gqlparser/v2 v2.5.27/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= +golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= +google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/gateway/search_stub/main.go b/gateway/search_stub/main.go new file mode 100644 index 0000000..1137d72 --- /dev/null +++ b/gateway/search_stub/main.go @@ -0,0 +1,64 @@ +// filepath: gateway/search_stub/main.go +package main + +import ( + "context" + "log" + "net" + + "google.golang.org/grpc" + pb "github.com/DO-2K23-26/polypass-microservices/gateway/proto/search" +) + +// mockServer implements the gRPC SearchService with dummy data +type mockServer struct { + pb.UnimplementedSearchServiceServer +} + +func (s *mockServer) SearchFolders(ctx context.Context, req *pb.SearchFoldersRequest) (*pb.SearchFoldersResponse, error) { + return &pb.SearchFoldersResponse{ + Total: 1, + Folders: []*pb.Folder{{ + Id: "f1", + Name: "MockFolder", + ParentId: "", + }}, + }, nil +} + +func (s *mockServer) SearchTags(ctx context.Context, req *pb.SearchTagsRequest) (*pb.SearchTagsResponse, error) { + return &pb.SearchTagsResponse{ + Total: 1, + Tags: []*pb.Tag{{ + Id: "t1", + Name: "MockTag", + FolderId: "f1", + }}, + }, nil +} + +func (s *mockServer) SearchCredentials(ctx context.Context, req *pb.SearchCredentialsRequest) (*pb.SearchCredentialsResponse, error) { + return &pb.SearchCredentialsResponse{ + Total: 1, + Credentials: []*pb.Credential{{ + Id: "c1", + Title: "MockCredential", + FolderId: "f1", + Folder: &pb.Folder{Id: "f1", Name: "MockFolder", ParentId: ""}, + Tags: []*pb.Tag{{Id: "t1", Name: "MockTag", FolderId: "f1"}}, + }}, + }, nil +} + +func main() { + lis, err := net.Listen("tcp", ":50051") + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + grpcServer := grpc.NewServer() + pb.RegisterSearchServiceServer(grpcServer, &mockServer{}) + log.Println("Mock SearchService gRPC running on :50051") + if err := grpcServer.Serve(lis); err != nil { + log.Fatalf("failed to serve: %v", err) + } +} diff --git a/gateway/tmp/build-errors.log b/gateway/tmp/build-errors.log new file mode 100644 index 0000000..0be2c41 --- /dev/null +++ b/gateway/tmp/build-errors.log @@ -0,0 +1 @@ +exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1 \ No newline at end of file