Exemplo n.º 1
0
        public async Task <ISchemaFeatures> GetSchemaFeaturesAsync(
            HttpClient client,
            CancellationToken cancellationToken = default)
        {
            if (client is null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            HttpQueryRequest request = IntrospectionQueryHelper.CreateFeatureQuery();

            IntrospectionResult result = await ExecuteIntrospectionAsync(
                client, request, cancellationToken)
                                         .ConfigureAwait(false);

            EnsureNoGraphQLErrors(result);

            return(SchemaFeatures.FromIntrospectionResult(result));
        }
Exemplo n.º 2
0
        public async Task <DocumentNode> DownloadSchemaAsync(
            HttpClient client,
            CancellationToken cancellationToken = default)
        {
            if (client is null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            ISchemaFeatures features = await GetSchemaFeaturesAsync(
                client, cancellationToken)
                                       .ConfigureAwait(false);

            HttpQueryRequest request = IntrospectionQueryHelper.CreateIntrospectionQuery(features);

            IntrospectionResult result = await ExecuteIntrospectionAsync(
                client, request, cancellationToken)
                                         .ConfigureAwait(false);

            EnsureNoGraphQLErrors(result);

            return(IntrospectionDeserializer.Deserialize(result).RemoveBuiltInTypes());
        }