File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 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
45A 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
6962var 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
You can’t perform that action at this time.
0 commit comments