dynamic_graphql/
upload.rs

1use std::borrow::Cow;
2
3use async_graphql::Upload;
4use async_graphql::dynamic;
5use async_graphql::dynamic::Type;
6use async_graphql::dynamic::ValueAccessor;
7
8use crate::errors::InputValueResult;
9use crate::from_value::FromValue;
10use crate::registry::Registry;
11use crate::types::InputTypeName;
12use crate::types::Register;
13use crate::types::TypeName;
14
15impl TypeName for Upload {
16    fn get_type_name() -> Cow<'static, str> {
17        dynamic::TypeRef::UPLOAD.into()
18    }
19}
20
21impl InputTypeName for Upload {}
22
23impl FromValue for Upload {
24    fn from_value(value: async_graphql::Result<ValueAccessor>) -> InputValueResult<Self> {
25        Ok(value?.upload()?)
26    }
27}
28
29impl Register for Upload {
30    fn register(registry: Registry) -> Registry {
31        registry.register_type(Type::Upload)
32    }
33}