Trait GraphqlSourceMiddleware

Source
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§

Source

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.

Source

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.

Source

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,

Source

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,

Source

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,

Implementations on Foreign Types§

Source§

impl GraphqlSourceMiddleware for Arc<dyn GraphqlSource>

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Implementors§