reactive_graph_plugin_api/graphql/web_resource_provider.rs
1use async_trait::async_trait;
2use http::Request;
3use http::Response;
4use http::Result;
5use uuid::Uuid;
6
7use crate::HttpBody;
8use crate::injectable;
9
10#[async_trait]
11#[injectable]
12pub trait WebResourceProvider: Send + Sync {
13 fn id(&self) -> Uuid;
14
15 /// The context path segment.
16 fn get_context_path(&self) -> String;
17
18 /// Handles a web resource.
19 async fn handle_web_resource(&self, path: String, request: Request<HttpBody>) -> Result<Response<HttpBody>>;
20}