@@ -16,6 +16,19 @@ pub async fn post_graphql<Q: GraphQLQuery, U: reqwest::IntoUrl>(
1616 reqwest_response. json ( ) . await
1717}
1818
19+ /// Use the provided reqwest::Client to post a GraphQL request.
20+ #[ cfg( any( feature = "reqwest" , feature = "reqwest-rustls" ) ) ]
21+ pub async fn post_graphql_batch < Q : GraphQLQuery , U : reqwest:: IntoUrl > (
22+ client : & reqwest:: Client ,
23+ url : U ,
24+ variables : Vec < Q :: Variables > ,
25+ ) -> Result < crate :: Response < Q :: ResponseData > , reqwest:: Error > {
26+ let body = Q :: build_batch_query ( variables) ;
27+ let reqwest_response = client. post ( url) . json ( & body) . send ( ) . await ?;
28+
29+ reqwest_response. json ( ) . await
30+ }
31+
1932/// Use the provided reqwest::Client to post a GraphQL request.
2033#[ cfg( feature = "reqwest-blocking" ) ]
2134pub fn post_graphql_blocking < Q : GraphQLQuery , U : reqwest:: IntoUrl > (
@@ -28,3 +41,16 @@ pub fn post_graphql_blocking<Q: GraphQLQuery, U: reqwest::IntoUrl>(
2841
2942 reqwest_response. json ( )
3043}
44+
45+ /// Use the provided reqwest::Client to post a GraphQL request.
46+ #[ cfg( feature = "reqwest-blocking" ) ]
47+ pub fn post_graphql_blocking_batch < Q : GraphQLQuery , U : reqwest:: IntoUrl > (
48+ client : & reqwest:: blocking:: Client ,
49+ url : U ,
50+ variables : Vec < Q :: Variables > ,
51+ ) -> Result < crate :: Response < Q :: ResponseData > , reqwest:: Error > {
52+ let body = Q :: build_batch_query ( variables) ;
53+ let reqwest_response = client. post ( url) . json ( & body) . send ( ) ?;
54+
55+ reqwest_response. json ( )
56+ }
0 commit comments