Beispiel #1
0
 public GraphQLSubscriptionClient(WebSocket webSocket, CancellationToken cancellationToken, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization deserialization)
 {
     WebSocket          = webSocket;
     FieldBuilder       = fieldBuilder;
     QueryGenerator     = queryGenerator;
     Deserialization    = deserialization;
     _cancellationToken = cancellationToken;
 }
 public GraphQLSubscriptionWebSocketClient(IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization deserialization, CancellationToken cancellationToken)
 {
     _cancellationToken = cancellationToken;
     _webSocket.Options.AddSubProtocol("graphql-ws");
     this.fieldBuilder    = fieldBuilder;
     this.queryGenerator  = queryGenerator;
     this.deserialization = deserialization;
 }
 public GraphQLBatchMerger(string url, HttpMethod httpMethod, string authorizationToken, string authorizationMethod, IGraphQLHttpExecutor executor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator)
 {
     _url                 = url;
     _httpMethod          = httpMethod;
     _authorizationToken  = authorizationToken;
     _authorizationMethod = authorizationMethod;
     _executor            = executor;
     _fieldBuilder        = fieldBuilder;
     _queryGenerator      = queryGenerator;
     _fields              = new Dictionary <string, IEnumerable <GraphQLFieldWithOverridedAlias> >();
     _arguments           = new Dictionary <string, GraphQLQueryArgument[]>();
 }
 public GraphQLQuery(GraphQLOperationType operationType, IEnumerable <GraphQLField> selectionSet, GraphQLQueryArgument[] arguments, string url, HttpMethod httpMethod, string authorizationToken, string authorizationMethod, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLHttpExecutor executor, IGraphQLDeserialization deserilization)
 {
     _url                 = url ?? throw new ArgumentNullException(nameof(url));
     _httpMethod          = httpMethod ?? throw new ArgumentNullException(nameof(httpMethod));
     _executor            = executor ?? throw new ArgumentNullException(nameof(executor));
     this._deserilization = deserilization;
     _authorizationMethod = authorizationMethod;
     this._queryGenerator = queryGenerator;
     _authorizationToken  = authorizationToken;
     OperationType        = operationType;
     SelectionSet         = selectionSet;
     _arguments           = arguments;
 }
Beispiel #5
0
 public GraphQLBatchMerger(GraphQLOperationType graphQLOperationType, string url, HttpMethod httpMethod, IDictionary <string, string> headers, string authorizationToken, string authorizationMethod, IGraphQLHttpExecutor executor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization graphQLDeserialization)
 {
     _graphQLOperationType = graphQLOperationType;
     _url                    = url;
     _httpMethod             = httpMethod;
     _headers                = headers;
     _authorizationToken     = authorizationToken;
     _authorizationMethod    = authorizationMethod;
     _executor               = executor;
     _fieldBuilder           = fieldBuilder;
     _queryGenerator         = queryGenerator;
     _graphQLDeserialization = graphQLDeserialization;
     _fields                 = new Dictionary <string, IEnumerable <GraphQLFieldWithOverridedAlias> >();
     _arguments              = new Dictionary <string, GraphQLQueryArgumentWithOverriddenVariable[]>();
 }
Beispiel #6
0
        /// <summary>
        /// Builds a GraphQL mutation from the specified <see cref="Type"/> and the <see cref="GraphQLQueryArgument"/>s
        /// </summary>
        /// <typeparam name="T">The type to generate the mutation from</typeparam>
        /// <param name="queryGenerator">The queryGenerator used to generate the query</param>
        /// <param name="fieldBuilder">The fieldBuilder used for examining the type</param>
        /// <param name="arguments">The argument values which is inserted using a variable on specified arguments with the <see cref="GraphQLArgumentsAttribute"/></param>
        /// <returns>The generated mutation</returns>
        public static string GetMutation <T>(this IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLFieldBuilder fieldBuilder,
                                             params GraphQLQueryArgument[] arguments)
        {
            if (queryGenerator == null)
            {
                throw new ArgumentNullException(nameof(queryGenerator));
            }
            if (fieldBuilder == null)
            {
                throw new ArgumentNullException(nameof(fieldBuilder));
            }
            var selectionSet = fieldBuilder.GenerateSelectionSet(typeof(T));

            return(queryGenerator.GenerateQuery(GraphQLOperationType.Mutation, selectionSet, arguments));
        }
Beispiel #7
0
 public GraphQLQuery(GraphQLOperationType operationType, IEnumerable <GraphQLField> selectionSet, GraphQLQueryArgument[] arguments, string url, HttpMethod httpMethod, Func <GraphQLField, bool> filter, string authorizationToken, string authorizationMethod, IDictionary <string, string> headers, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLHttpExecutor executor, IGraphQLDeserialization deserilization)
 {
     this._url                 = url ?? throw new ArgumentNullException(nameof(url));
     this._httpMethod          = httpMethod;
     this._executor            = executor ?? throw new ArgumentNullException(nameof(executor));
     this._deserilization      = deserilization;
     this._authorizationMethod = authorizationMethod;
     this._queryGenerator      = queryGenerator;
     this._authorizationToken  = authorizationToken;
     this.OperationType        = operationType;
     this.SelectionSet         = selectionSet;
     this._arguments           = arguments;
     this._headers             = headers;
     this._filter              = filter;
 }
        /// <summary>
        /// Builds a GraphQL mutation from the specified <see cref="Type"/> and the <see cref="GraphQLQueryArgument"/>s
        /// </summary>
        /// <typeparam name="T">The type to generate the mutation from</typeparam>
        /// <param name="queryGenerator">The queryGenerator used to generate the query</param>
        /// <param name="fieldBuilder">The fieldBuilder used for examining the type</param>
        /// <param name="arguments">The argument values which is inserted using a variable on specified arguments with the <see cref="GraphQLArgumentsAttribute"/></param>
        /// <returns>The generated mutation</returns>
        public static string GetMutation <T>(this IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLFieldBuilder fieldBuilder,
                                             params GraphQLQueryArgument[] arguments)
        {
            if (queryGenerator == null)
            {
                throw new ArgumentNullException(nameof(queryGenerator));
            }
            if (fieldBuilder == null)
            {
                throw new ArgumentNullException(nameof(fieldBuilder));
            }
            var fields = fieldBuilder.GetFields(typeof(T));

            return(queryGenerator.GetMutation(fields, arguments));
        }
Beispiel #9
0
 public GraphQLHttpClient(IGraphQLHttpExecutor httpExecutor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization deserialization, IQueryGeneratorFilter filterGenerator)
 {
     HttpExecutor    = httpExecutor ?? throw new ArgumentNullException(nameof(httpExecutor));
     FieldBuilder    = fieldBuilder ?? throw new ArgumentNullException(nameof(fieldBuilder));
     QueryGenerator  = queryGenerator ?? throw new ArgumentNullException(nameof(queryGenerator));
     Deserialization = deserialization ?? throw new ArgumentNullException(nameof(deserialization));
     FilterGenerator = filterGenerator;
 }
Beispiel #10
0
 public GraphQLHttpClient(IGraphQLHttpExecutor httpExecutor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization deserialization)
     : this(httpExecutor, fieldBuilder, queryGenerator, deserialization, null)
 {
 }
Beispiel #11
0
 internal GraphQLBatch(GraphQLOperationType graphQLOperationType, string url, HttpMethod httpMethod, IDictionary <string, string> headers, string authorizationToken, string authorizationMethod, IGraphQLHttpExecutor executor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization deserialization)
 {
     _batch = new GraphQLBatchMerger(graphQLOperationType, url, httpMethod, headers, authorizationToken, authorizationMethod, executor, fieldBuilder, queryGenerator, deserialization);
 }
Beispiel #12
0
 public NestedIntegrationTests()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
     _fieldBuilder   = new GraphQLFieldBuilder();
     _deserilization = new GraphQLDeserilization();
 }
 public DirectiveTest()
 {
     _fieldBuilder   = new GraphQLFieldBuilder();
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
 public DefaultArgumentIntegrationTests()
 {
     _fieldBuilder   = new GraphQLFieldBuilder();
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
 /// <summary>
 /// Initilizes a new instance of GraphQL client which supports generating GraphQL queries and mutations from a <see cref="Type"/>
 /// </summary>
 /// <param name="executor">The <see cref="IGraphQLHttpExecutor"/> to use for the GraphQL client</param>
 /// <param name="fieldBuilder">The <see cref="IGraphQLFieldBuilder"/> used for generating the fields used for generating the query</param>
 /// <param name="queryGenerator">The <see cref="IGraphQLQueryGeneratorFromFields"/> used for the GraphQL client</param>
 public GraphQLHttpClient(IGraphQLHttpExecutor executor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator)
 {
     _executor       = executor ?? throw new ArgumentNullException(nameof(executor));
     _fieldBuilder   = fieldBuilder ?? throw new ArgumentNullException(nameof(fieldBuilder));
     _queryGenerator = queryGenerator ?? throw new ArgumentNullException(nameof(queryGenerator));
 }
 public GraphQLSubscriptionWebSocketClient(IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLDeserialization deserialization, CancellationToken cancellationToken) :
     this(new ClientWebSocket(), fieldBuilder, queryGenerator, deserialization, cancellationToken)
 {
 }
Beispiel #17
0
 internal GraphQLBatch(string url, HttpMethod httpMethod, string authorizationToken, string authorizationMethod, IGraphQLHttpExecutor executor, IGraphQLFieldBuilder fieldBuilder, IGraphQLQueryGeneratorFromFields queryGenerator)
 {
     _batch = new GraphQLBatchMerger(url, httpMethod, authorizationToken, authorizationMethod, executor, fieldBuilder, queryGenerator);
 }
 public DirectiveTest()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #19
0
 public FieldTests()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #20
0
 public QueryGeneratorIntrationTests()
 {
     _fieldBuilder   = new GraphQLFieldBuilder();
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
 public SubscriptionTests()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #22
0
 public TestCaseInsensitiveAliasFieldMatch()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #23
0
 public SubscriptionIntegrationTests()
 {
     _fieldBuilder   = new GraphQLFieldBuilder();
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #24
0
 public DefaultArgumentValueTest()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #25
0
 public QueryGeneratorVariableTest()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }
Beispiel #26
0
 public GraphQLQuery(GraphQLOperationType operationType, IEnumerable <GraphQLField> selectionSet, GraphQLQueryArgument[] arguments, string url, HttpMethod httpMethod, string authorizationToken, string authorizationMethod, IDictionary <string, string> headers, IGraphQLQueryGeneratorFromFields queryGenerator, IGraphQLHttpExecutor executor, IGraphQLDeserialization deserilization)
     : this(operationType : operationType,
            selectionSet : selectionSet,
            arguments : arguments,
            url : url,
            httpMethod : httpMethod,
            filter : null,
            authorizationToken : authorizationToken,
            authorizationMethod : authorizationMethod,
            headers : headers,
            queryGenerator : queryGenerator,
            executor : executor,
            deserilization : deserilization)
 {
 }
Beispiel #27
0
 public AliasNullTests()
 {
     _queryGenerator = new GraphQLQueryGeneratorFromFields();
 }