fluentci_graphql/schema/
http.rs1use std::sync::{Arc, Mutex};
2
3use super::objects::file::File;
4use async_graphql::{Context, Error, Object};
5use fluentci_common::http::http as common_http;
6use fluentci_core::deps::Graph;
7
8#[derive(Default, Clone)]
9pub struct HttpQuery;
10
11#[Object]
12impl HttpQuery {
13 async fn http(&self, ctx: &Context<'_>, url: String) -> Result<File, Error> {
14 let graph = ctx.data::<Arc<Mutex<Graph>>>().unwrap();
15 let http = common_http(graph.clone(), url, true)?;
16 Ok(File::from(http))
17 }
18}