Exemplo n.º 1
0
        /// <inheritdoc />
        public override IGraphType GenerateGraphType(NodeInterface nodeInterface, List <TypeInterface> interfaces)
        {
            var graphType = new VirtualGraphType(this.ComplexTypeName);

            graphType.AddField(
                new FieldType
            {
                Name         = "deletedId",
                ResolvedType = new IdGraphType(),
                Resolver     = new DeletedIdResolver()
            });
            graphType.AddField(
                this.CreateField(
                    "node",
                    this.EdgeType.ObjectType,
                    new NodeResolver(this.EdgeType.ObjectType)));
            graphType.AddField(this.CreateField("edge", this.EdgeType));
            graphType.AddField(this.CreateField("errors", this.ErrorType, new ResultErrorsResolver()));
            graphType.AddField(
                new FieldType
            {
                Name         = "clientMutationId",
                ResolvedType = new StringGraphType(),
                Resolver     = new ClientMutationIdIdResolver()
            });
            graphType.AddField(this.CreateField("api", this.root, this.root));
            return(graphType);
        }
        /// <inheritdoc />
        public override IGraphType GenerateGraphType(NodeInterface nodeInterface, List <TypeInterface> interfaces)
        {
            var graphType = new VirtualGraphType(this.ComplexTypeName);

            graphType.AddField(this.CreateField("result", this.OriginalReturnType, new ResultResolver(this.OriginalReturnType)));
            graphType.AddField(new FieldType {
                Name = "clientMutationId", ResolvedType = new StringGraphType(), Resolver = new MergedConnectionMutationResultType.ClientMutationIdIdResolver()
            });
            graphType.AddField(this.CreateField("api", this.root, this.root));
            return(graphType);
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public override IGraphType GenerateGraphType(NodeInterface nodeInterface, List <TypeInterface> interfaces)
        {
            var fields = new List <FieldType>
            {
                new FieldType
                {
                    Name         = "cursor",
                    ResolvedType = new StringGraphType(),
                    Resolver     = new CursorResolver(),
                    Description  =
                        "A value to use with paging positioning"
                },
                new FieldType
                {
                    Name         = "node",
                    ResolvedType = new VirtualGraphType("tmp"),
                    Metadata     =
                        new Dictionary <string, object>
                    {
                        {
                            MetaDataTypeKey,
                            new MergedField(
                                "node",
                                this.ObjectType,
                                this.Provider,
                                null,
                                description: this.ObjectType.Description)
                            {
                                Resolver = new NodeResolver(this.ObjectType)
                            }
                        }
                    }
                }
            };

            var generateGraphType = new VirtualGraphType(this.ComplexTypeName, fields)
            {
                Description = this.Description
            };

            if (interfaces != null)
            {
                foreach (var typeInterface in interfaces)
                {
                    typeInterface.AddPossibleType(generateGraphType);
                    generateGraphType.AddResolvedInterface(typeInterface);
                }
            }

            return(generateGraphType);
        }
        /// <inheritdoc />
        public override IGraphType GenerateGraphType(NodeInterface nodeInterface, List <TypeInterface> interfaces)
        {
            var fields = new List <FieldType>
            {
                new FieldType
                {
                    Name         = "count",
                    ResolvedType = new IntGraphType(),
                    Resolver     = new CountResolver(),
                    Description  =
                        "The total count of objects satisfying filter conditions"
                },
                new FieldType
                {
                    Name        = "edges",
                    Description =
                        "The list of edges according to filtering and paging conditions",
                    ResolvedType = new VirtualGraphType("tmp"),
                    Metadata     =
                        new Dictionary <string, object>
                    {
                        {
                            MetaDataTypeKey,
                            new MergedField(
                                "edges",
                                this.EdgeType,
                                this.Provider,
                                null,
                                EnFieldFlags.IsArray,
                                description: "The list of edges according to filtering and paging conditions")
                        }
                    }
                }
            };

            var generateGraphType = new VirtualGraphType(this.ComplexTypeName, fields)
            {
                Description = this.Description
            };

            if (interfaces != null)
            {
                foreach (var typeInterface in interfaces)
                {
                    typeInterface.AddPossibleType(generateGraphType);
                    generateGraphType.AddResolvedInterface(typeInterface);
                }
            }

            return(generateGraphType);
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public override IGraphType GenerateGraphType(NodeInterface nodeInterface, List <TypeInterface> interfaces)
        {
            var fields    = this.Fields.Select(this.ConvertApiField);
            var graphType = new VirtualGraphType(this.ComplexTypeName, fields.ToList())
            {
                Description = this.Description
            };

            if (interfaces != null)
            {
                foreach (var typeInterface in interfaces)
                {
                    typeInterface.AddImplementedType(this.ComplexTypeName, graphType);
                    graphType.AddResolvedInterface(typeInterface);
                }
            }

            return(graphType);
        }