Пример #1
0
        public static async Task <string> PostToJsonAsync(this GraphQlClient client, GraphQlMutation mutation, params KeyValuePair <string, string>[] headers)
        {
            var response = await client.PostMutationAsync(mutation, headers);

            await using var stream = response?.GetResponseStream();

            using var reader = new StreamReader(stream ?? throw new InvalidOperationException(), Encoding.UTF8);
            return(reader.ReadToEnd());
        }
Пример #2
0
 public async Task Test1()
 {
     var client   = new GraphQlClient("http://localhost:5000/graphql", new Serializer());
     var response = await client.Query(new HeroQuery());
 }
Пример #3
0
 public static string PostToJson(this GraphQlClient client, GraphQlMutation mutation, params KeyValuePair <string, string>[] headers)
 => PostToJsonAsync(client, mutation, headers).Result;
Пример #4
0
 public static string PostToJson(this GraphQlClient client, GraphQlQuery query, params KeyValuePair <string, string>[] headers)
 => PostToJsonAsync(client, query, headers).Result;