pub trait GraphqlSourceMiddleware:
Send
+ Sync
+ 'static
+ RemoteGraphQLDataSource {
// Provided methods
fn will_send_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 mut HashMap<String, String>,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn did_receive_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
response: &'life1 mut Response,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn on_connection_init<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut Option<Value>,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn fetch<'life0, 'async_trait>(
&'life0 self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn subscribe<'life0, 'async_trait>(
&'life0 self,
_request: Request,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = Result<Response>>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Implement GraphqlSourceMiddleware for your source, if you want to modify requests to the subgraph before they’re sent and modify response after it.
Provided Methods§
Sourcefn will_send_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 mut HashMap<String, String>,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn will_send_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 mut HashMap<String, String>,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Override will_send_request to modify your gateway’s requests to the subgraph before they’re sent.
Sourcefn did_receive_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
response: &'life1 mut Response,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn did_receive_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
response: &'life1 mut Response,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Override did_receive_response to modify your gateway’s response after request to the subgraph. It will not modify response of subscription.