1+ using System . IO ;
12using System . Threading . Tasks ;
23using GraphQL . Common . Request ;
34using GraphQL . Common . Response ;
@@ -95,7 +96,7 @@ fragment TypeRef on __Type {
9596 }
9697 }
9798 }
98- }" . Replace ( "\t " , "" ) . Replace ( "\n " , "" ) . Replace ( "\r " , "" ) ,
99+ }" . Replace ( "\t " , "" ) . Replace ( "\n " , "" ) . Replace ( "\r " , "" ) ,
99100 Variables = null
100101 } ;
101102
@@ -115,6 +116,24 @@ public static async Task<GraphQLResponse> GetIntrospectionQueryAsync(this GraphQ
115116 public static async Task < GraphQLResponse > PostIntrospectionQueryAsync ( this GraphQLClient graphQLClient ) =>
116117 await graphQLClient . PostAsync ( IntrospectionQuery ) . ConfigureAwait ( false ) ;
117118
119+ /// <summary>
120+ /// Send the Query defined in a file via GET
121+ /// </summary>
122+ /// <param name="graphQLClient">The GraphQLClient</param>
123+ /// <param name="filePath">The Path of the File</param>
124+ /// <returns>The GraphQLResponse</returns>
125+ public static async Task < GraphQLResponse > GetFromFile ( this GraphQLClient graphQLClient , string filePath ) =>
126+ await graphQLClient . GetQueryAsync ( File . ReadAllText ( filePath ) ) . ConfigureAwait ( false ) ;
127+
128+ /// <summary>
129+ /// Send the Query defined in a file via POST
130+ /// </summary>
131+ /// <param name="graphQLClient">The GraphQLClient</param>
132+ /// <param name="filePath">The Path of the File</param>
133+ /// <returns>The GraphQLResponse</returns>
134+ public static async Task < GraphQLResponse > PostFromFile ( this GraphQLClient graphQLClient , string filePath ) =>
135+ await graphQLClient . PostQueryAsync ( File . ReadAllText ( filePath ) ) . ConfigureAwait ( false ) ;
136+
118137 }
119138
120139}
0 commit comments