Skip to content

Commit 3ac61b1

Browse files
committed
fix examples and formatting
1 parent b57364b commit 3ac61b1

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# GraphQL.Client
22
[![NuGet](https://img.shields.io/nuget/v/GraphQL.Client.svg)](https://www.nuget.org/packages/GraphQL.Client)
3+
[![NuGet](https://img.shields.io/nuget/vpre/GraphQL.Client.svg)](https://www.nuget.org/packages/GraphQL.Client)
34

45
A GraphQL Client for .NET Standard over HTTP.
56

@@ -56,15 +57,7 @@ public class HeroAndFriendsResponse {
5657
}
5758
}
5859

59-
var graphQLResponse = await graphQLClient.SendQueryAsync(
60-
heroAndFriendsRequest,
61-
() => new {
62-
hero = new {
63-
name = string.Empty ,
64-
friends = new List<new { name = string.Empty}>
65-
}
66-
}
67-
);
60+
var graphQLResponse = await graphQLClient.SendQueryAsync<HeroAndFriendsResponse>(heroAndFriendsRequest);
6861

6962
var heroName = graphQLResponse.Data.Hero.Name;
7063
```
@@ -95,9 +88,13 @@ var userJoinedRequest = new GraphQLRequest {
9588
}"
9689
};
9790

98-
IObservable<GraphQLResponse<UserJoinedSubscriptionResult>> subscriptionStream = client.CreateSubscriptionStream<UserJoinedSubscriptionResult>(userJoinedRequest);
91+
IObservable<GraphQLResponse<UserJoinedSubscriptionResult>> subscriptionStream
92+
= client.CreateSubscriptionStream<UserJoinedSubscriptionResult>(userJoinedRequest);
9993

100-
var subscription = subscriptionStream.Subscribe(response => Console.WriteLine($"user '{response.Data.UserJoined.DisplayName}' joined"));
94+
var subscription = subscriptionStream.Subscribe(response =>
95+
{
96+
Console.WriteLine($"user '{response.Data.UserJoined.DisplayName}' joined")
97+
});
10198
```
10299

103100
#### End Subscription

0 commit comments

Comments
 (0)