use async_graphql::{ObjectType, SubscriptionType, Schema, SchemaBuilder as AsyncSchemaBuilder};
pub struct SchemaBuilder<Q, M, S>
where
Q: ObjectType + 'static,
M: ObjectType + 'static,
S: SubscriptionType + 'static,
{
inner: AsyncSchemaBuilder<Q, M, S>,
}
impl<Q, M, S> SchemaBuilder<Q, M, S>
where
Q: ObjectType + 'static,
M: ObjectType + 'static,
S: SubscriptionType + 'static,
{
pub fn new(query: Q, mutation: M, subscription: S) -> Self {
Self {
inner: Schema::build(query, mutation, subscription),
}
}
pub fn max_depth(self, depth: usize) -> Self {
Self {
inner: self.inner.limit_depth(depth),
}
}
pub fn max_complexity(self, complexity: usize) -> Self {
Self {
inner: self.inner.limit_complexity(complexity),
}
}
pub fn data<T: Send + Sync + 'static>(self, value: T) -> Self {
Self {
inner: self.inner.data(value),
}
}
pub fn finish(self) -> Schema<Q, M, S> {
self.inner.finish()
}
}