This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| builder.RegisterType<DocumentExecuter>().As<IDocumentExecuter>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| builder.RegisterType<GraphQLSchema>().As<ISchema>(); | |
| builder.Register<Func<Type, GraphType>>(c => | |
| { | |
| var context = c.Resolve<IComponentContext>(); | |
| return t => { | |
| var res = context.Resolve(t); | |
| return (GraphType)res; | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GraphQLSchema : Schema | |
| { | |
| public GraphQLSchema(Func<Type, GraphType> resolveType) | |
| : base(resolveType) | |
| { | |
| Query = (GraphQLQuery)resolveType(typeof(GraphQLQuery)); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Route("api/graphql")] | |
| public class GraphQLController : Controller | |
| { | |
| private readonly GraphQLQuery _graphQLQuery; | |
| private readonly IDocumentExecuter _documentExecuter; | |
| private readonly ISchema _schema; | |
| public GraphQLController(GraphQLQuery graphQLQuery, IDocumentExecuter documentExecuter, ISchema schema) | |
| { | |
| _graphQLQuery = graphQLQuery; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GraphQLParameter | |
| { | |
| public string Query { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BranchesResolver : Resolver, IBranchesResolver | |
| { | |
| private readonly IBranchesService _branchesService; | |
| public BranchesResolver(IBranchesService branchesService) | |
| { | |
| _branchesService = branchesService; | |
| } | |
| public void Resolve(GraphQLQuery graphQLQuery) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ResponseListGraphType<TGraphType> : ObjectGraphType<Response> where TGraphType : GraphType | |
| { | |
| public ResponseListGraphType() | |
| { | |
| Name = $"ResponseList{typeof(TGraphType).Name}"; | |
| Field(x => x.StatusCode, nullable: true).Description("Status code of the request."); | |
| Field(x => x.ErrorMessage, nullable: true).Description("Error message if requests fails."); | |
| Field<ListGraphType<TGraphType>>( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BranchesResolver : Resolver, IBranchesResolver | |
| { | |
| private readonly IBranchesService _branchesService; | |
| public BranchesResolver(IBranchesService branchesService) | |
| { | |
| _branchesService = branchesService; | |
| } | |
| public void Resolve(GraphQLQuery graphQLQuery) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Resolver | |
| { | |
| public Response Response(object data) | |
| { | |
| return new Response(data); | |
| } | |
| public Response Error(GraphQLError error) | |
| { | |
| return new Response(error.StatusCode, error.ErrorMessage); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BranchesResolver : IBranchesResolver | |
| { | |
| private readonly IBranchesService _branchesService; | |
| public BranchesResolver(IBranchesService branchesService) | |
| { | |
| _branchesService = branchesService; | |
| } | |
| public void Resolve(GraphQLQuery graphQLQuery) |